Select row only if ID is in excel file
I want to select rows from df only if their ID is in excel file. Why am I getting 0 rows?
df = pd.read_excel('df.xlsx')
df_with_status = pd.read_excel('df_status.xlsx')
df2=df[df['EFF_ID'].isin([df_with_status['ID']])]
I have got 0 rows but I should get more records.
Not totally sure, but I think you have to remove the brackets at the isin() in this line
df2=df[df['EFF_ID'].isin([df_with_status['ID']])]
i.e. it should read
df2=df[df['EFF_ID'].isin(df_with_status['ID'])]
The reason is, that you are comparing the values against a list of data-frames instead of the list of values.