我的 ots 列有:2021-04-03 14:01:22.791856
它的dtype是dtype('<M8[ns]')
我如何才能獲得2021-04-03 14:01:22?
uj5u.com熱心網友回復:
使用這個:https : //pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.dt.strftime.html
考慮到這是您在熊貓資料框中的時間列:
df['time'] = df['time'].dt.strftime('%Y-%m-%d %H:%M:%S')
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/370513.html
上一篇:如何將LocalDateTime決議為兩位數毫秒?爪哇
下一篇:Python:生成每周時間戳
