Skip to content Skip to sidebar Skip to footer

Trying To Merge 2 Dataframes But Receiving Value Error Of Merging Object And Int32 Columns

I have been trying to address an issue mentioned here I had been trying to use a list of dates to filter a dataframe, and a very gracious person was helping me, but now with the cu

Solution 1:

The columns on which you want to merge are not the same types in both dataframes. Likely one is string the other integer. You should convert to the same type before merging. Assuming from the little bit you showed, before your merge, run:

tmp['DayNumber'] = tmp['DayNumber'].astype(int)

Alternatively:

df_melt_test_percent['DayNumber'] = df_melt_test_percent['DayNumber'].astype(str)

NB. This might not work as you did not provide a full example. Either search by yourself the right types or provide a reproducible example.


Post a Comment for "Trying To Merge 2 Dataframes But Receiving Value Error Of Merging Object And Int32 Columns"