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

后端 未结 6 756
情深已故
情深已故 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:34

    The following will convert what you have to datetime.time() objects:

    dataset['TimeStamp'] = pd.Series([val.time() for val in dataset['TimeStamp']])
    

    Output

      TimeStamp
    0  05:15:00
    1  05:28:00
    2  06:15:00
    

提交回复
热议问题