Skip to content Skip to sidebar Skip to footer

Am I Doing A Df.merge Wrong?

So I have one df1 which looks has this row amongst others PlayDate Timeslot UserID 2005-09-09 6-16-1 59 and I have df2 which contains: UserID PlayDate Timeslot PlayC

Solution 1:

Check to make sure that your dtypes of your dataframes match.

df1['PlayDate'] = pd.to_datetime(df1['PlayDate'])
df2['PlayDAte'] = pd.to_datetime(df2['PlayDate'])
df1.merge(df2,how='outer',on=['Timeslot','PlayDate','UserID'])

Output:

     PlayDate Timeslot  UserID  PlayCount   EstProb
0  2005-09-09   6-16-1      59          1  0.214459

Post a Comment for "Am I Doing A Df.merge Wrong?"