Reputation: 29
I'm having a hard time with pd.to_datetime() in Python 3 on Anaconda. Hopefully it's a simple fix, but it's saying that the issue is the data is a series type and not a DataFrame. Can someone please let me know if there's a quick fix to this?
This is the code that's giving me an error:
pd.to_datetime(Confirmed_Date_test.ObservationDate, errors='coerce', format='%d%m%Y')
This is the error I'm getting:
Here is the code where the data is wrangled:
Upvotes: 0
Views: 182
Reputation: 29
It was resolved by adding .to_frame() to the end of the ln 39.
Upvotes: 0
Reputation: 2819
Observation Date is the index of your groupby result. Add a reset index before the pd.todatetime():
Confirmed_Date_test.reset_index(inplace=true)
Upvotes: 2