I've got data in excel, one sheet has dates as columns, the other - as rows. Using pd.read_excel I get them as dataframes. The type of one (Data1) is datetime.datetime, the other (Data2) is timestamp.
- How do I prevent this from happening and get uniform types?
I want to do
Data1[Data1.index<Data2.columns[-1]]
this returns an error
TypeError: '<=' not supported between instances of 'datetime.time' and 'Timestamp'
I tried doing
datetime(Data2.columns[-1].year,Data2.columns[-1].month,Data2.columns[-1].day)
instead of
Data2.columns[-1]
the error changes to
TypeError: '<=' not supported between instances of 'datetime.time' and 'datetime.datetime'
- I'm lost, how do I get the types to match? What's this datetime.time type out of thin air.
EDIT
this seems to be the crux of the issue:
Data1[Data1.index<Data1.index[3]]
returns
TypeError: '<' not supported between instances of 'datetime.time' and 'datetime.datetime'
Data type for Data1.index is datetime.time.
datetime.time.dt = datetime.fromtimestamp(ts)andts = dt.timestamp().