如何删除 Pandas 数据帧索引的 'seconds'?

How to remove the 'seconds' of Pandas dataframe index?

给定一个时间序列数据框,如下所示:

                      Close
2015-02-20 14:00:00  1200.1
2015-02-20 14:10:00  1199.8
2015-02-21 14:00:00  1199.3
2015-02-21 14:10:00  1199.0
2015-02-22 14:00:00  1198.4
2015-02-22 14:10:00  1199.7

如何删除索引的 'seconds' 使其看起来像这样:

                   Close
2015-02-20 14:00  1200.1
2015-02-20 14:10  1199.8
2015-02-21 14:00  1199.3
2015-02-21 14:10  1199.0
2015-02-22 14:00  1198.4
2015-02-22 14:10  1199.7

谢谢

您可以像这样使用 mapstrftime

df.index =df.index.map(lambda t: t.strftime('%Y-%m-%d %H:%M'))