1
我有所謂的「DF」一個熊貓數據幀如下大熊貓從日期時間指數
value
2015-09-27 03:58:30 1.0
2015-09-27 03:59:30 1.0
2015-09-27 04:00:30 1.0
2015-09-27 04:01:30 1.0
我只是想去掉秒得到這個
value
2015-09-27 03:58:00 1.0
2015-09-27 03:59:00 1.0
2015-09-27 04:00:00 1.0
2015-09-27 04:01:00 1.0
我怎樣才能做到這一點刪除秒?
香港專業教育學院嘗試的東西像
df.index.to_series().apply(datetime.replace(second=0, microsecond=0))
,但我總是得到錯誤
TypeError: descriptor 'replace' of 'datetime.datetime' object needs an argument