I have two data frames and I am trying to output the data that is in one but not the other.
I can get the data in the first dataframe but not the second using
only_new = old.merge( new, 'outer', on=['Employee ID', 'Benefit Plan Type'], suffixes=['','_'], indicator=True ).query('_merge == "left_only"').reindex_axis(old.columns, axis=1) Here is what I'm using to get the data that's only in my second dataframe
only_new =new.merge( old, 'outer', on=['Employee ID', 'Benefit Plan Type'], suffixes=['','_'], indicator=True ).query('_merge == "left only"').reindex_axis(new.columns, axis=1) But it doesn't return any data, but using Excel I can see that there should be a couple of rows.
It seems like this should work
only_new = old.merge(new, on='Employee ID', indicator=True, how='outer', only_new[only_new['_merge'] == 'right_only']) But I get
SyntaxError: non-keyword arg after keyword arg