how to convert multiple date formats in one format in pandas

后端 未结 2 1162
囚心锁ツ
囚心锁ツ 2021-01-19 04:57

I have following pandas dataframe with date column as object

   ID      Date                  Volume
   0       13-02-2018 00:06       85
   1           


        
相关标签:
2条回答
  • 2021-01-19 05:11

    try this:

    df['Date'] = pd.to_datetime(df.Date)
    
    df['Date'] = df['Date'].dt.strftime('%Y-%m-%d %H:%M')
    

    link: Series.dt.strftime

    0 讨论(0)
  • 2021-01-19 05:19

    Import time

    Localtime= time.asctime(time.localtime(time.time()))
    Print(localtime)
    

    Check if this we work

    0 讨论(0)
提交回复
热议问题