Answers for "pandas check if row exists in another dataframe"

0

pandas check if row exists in another dataframe

df = pd.merge(df1, df2, on=['User','Movie'], how='left', indicator='Exist')
df.drop('Rating', inplace=True, axis=1)
df['Exist'] = np.where(df.Exist == 'both', True, False)
print (df)
   User  Movie  Exist
0     1    333  False
1     1   1193   True
2     1      3  False
3     2    433  False
4     3     54   True
5     3    343  False
6     3     76   True
Posted by: Guest on March-23-2022

Code answers related to "pandas check if row exists in another dataframe"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language