Convert column of date objects in Pandas DataFrame to strings

后端 未结 2 657
夕颜
夕颜 2020-12-13 18:51

How to convert a column consisting of datetime64 objects to a strings that would read 01-11-2013 for today\'s date of November 1.

I have tried

df[\'         


        
2条回答
  •  情深已故
    2020-12-13 19:17

    As of version 17.0, you can format with the dt accessor:

    df['DateStr'] = df['DateObj'].dt.strftime('%d%m%Y')
    

提交回复
热议问题