0

I have a pandas column ['Date'] which has of the type datetime.datetime and looks like 2014-07-30 00:00:00. Now I want to convert it to the same datatype datetime.datetime but minus the time that is 2014-07-30 .

I tried a bunch of stuff like:

df['PSG Date '] =  pd.to_datetime(df['PSG Date '], format='%Y-%m-%-d %H:%M:%S')

but it didn't work.

edit

a=df['PSG Date '].iloc[0]
print(a,type(a))

gives <class 'datetime.datetime'>

doing df['PSG Date '] = df['PSG Date '].dt.date gives -

AttributeError: Can only use .dt accessor with datetimelike values

printing df['PSG Date'] gives the column with values like 2013-10-30 00:00:00 so on

ubuntu_noob
  • 2,305
  • 6
  • 23
  • 64

0 Answers0