I have two data frames , which I am trying to compare using <assert_frame_equal> . The comparison is failing over few columns which have timestamp values.The value seems to be same :
DF1 TIME 1970-01-01 02:00:00
Name: 4, dtype: object
----
DF2 TIME 1970-01-01 02:00:00
Name: 4, dtype: object
I checked the class of this column :
DF1 : <class 'pandas._libs.tslibs.timestamps.Timestamp'>
---
DF2: <class 'str'>
Error Message from using assert_frame_equal:
DataFrame Expected type <class 'pandas.core.frame.DataFrame'>, found <class 'pandas._libs.tslibs.timestamps.Timestamp'> instead
Can somebody please help , how can I make the classes of two dataframes same. My end goal is just to verify data , (no data types/classes etc). I can't give column name specifically as I have to use this function for multiple data frames , where column names for Date values vary.
question from:https://stackoverflow.com/questions/65933245/convert-the-class-of-one-dataframe-based-on-another-dataframe-classes