How to remove the date information in a column, just keep time

后端 未结 6 762
情深已故
情深已故 2020-12-19 01:54

I am using pandas dataframe. there is a specific column has time information.

the raw data likes this:

5:15am
5:28am
6:15am

so I ne

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-19 02:27

    There's a simpler way to do it using pandas, although most, if not all solutions are correct

    df.TimeStamp = pd.to_datetime(df.TimeStamp).dt.strftime('%H:%M')
    

提交回复
热议问题