I am trying to concatinate an older df(main_df) with a newer (ellicom_df) and then drop all the rows where i have the same manufacturer but a different date from the one making the update. However the code drops far too many lines than it should. In the example below old the main_df has 6269 lines the new (ellicom_df) has 7126 , the updated has (correctly) 13395 however after the drop i only get 3472 lines in the updated main_df, but i should have 7126 . I know the problem is either in the drop or in the date but i cant figure out where
print(ellicom_df.shape)
print(main_df.shape)
(7126, 4) (6269, 8)
date_=pd.Timestamp('now').date()
ellicom_df['UPDATED'] = date_
ellicom_df['MANUFACTURER']='ELLICOM'
main_df = pd.concat([main_df, ellicom_df], sort=False)
main_df.shape
(13395, 9)
main_df.drop(main_df.loc[(main_df['MANUFACTURER']=='ELLICOM') &
(main_df['UPDATED']!=date_)].index, inplace=True)
main_df.shape
(3472, 9)