I have a DataFrame column (named 'DateTime'), containing a time sequence with a timestep of one minute. They are objects. Each object has this format:

2018-01-10 00:00:00+01:00

2018-01-10 00:01:00+01:00

2018-01-10 00:02:00+01:00


2019-02-04 23:57:00+01:00

2019-02-04 23:58:00+01:00

2019-02-04 23:59:00+01:00

I need to convert them into datetime, so that to get date and time. How can i do that?

I tried this code:

data['DateTime'] = pd.to_datetime(data['DateTime'])

data['Date'] = data['DateTime'].dt.date

data['Time'] = data['DateTime'].dt.time

But i got the following error:

'ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True'

0 Answers