Issue
I have two different dataframes shown below.
This is the tel_times
dataframe
And this is the maint_comp1
dataframe.
Now, I have joined these two dataframes using merge
.
maint_tel_comp1 = pd.merge(tel_times, maint_comp1, how='inner', left_on=['machineID','datetime_tel'], right_on = ['machineID','datetime_maint'])
The result is
Solution
I believe what you want is:
maint_tel_comp1 = tel_times.merge(maint_comp1, on='machineID', how='inner')
maint_tel_comp1[maint_tel_comp1['datetime_tel'].gt(maint_tel_comp1['datetime_maint'])]
The problem is your merge was also ensuring datetime_tel == datetime_maint
, hence your condition was returning an empty DataFrame.
Answered By - user2246849
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.