这是我的DataFrame
:
issue,received_time
aa,25-06-15 08:42:43.830000000 PM
bb,25-06-15 08:42:43.830000000 PM
我需要输出:
issue,received_time
aa,25-06-15
bb,25-06-15
答案 0 :(得分:1)
我认为您可以使用dt.date
:
df['received_time'] = df['received_time'].dt.date
print df
issue received_time
0 aa 2015-06-25
1 bb 2015-06-25
如果列类型不是datetime
,请先按to_datetime
转换:
df['received_time'] = pd.to_datetime(df['received_time']).dt.date
print df
issue received_time
0 aa 2015-06-25
1 bb 2015-06-25