I've read another topics about drop rows based on column dataframe but this is not working (probably I'm doing something wrong).
I want to remove rows based on column value from unique_id
using the following code but all rows from df
are being removed:
df.drop(df[df["unique_id"].isin(dfb["unique_id"])].index, inplace=True)
When I run a print
for each dataframe, I have the following results:
print(len(dfb)) # 74
print(len(df)) # 124
The value of unique_id
is a hash based on all columns from dataframe so it's impossible to have same value because I don't have any duplicated row.
What is wrong in my code?
Here is another print about my code:
print(df[df['uniqueid'] == '8c3200304820d46f0708e329a345189b'])
#[1 rows x 19 columns]
print(dfb[dfb['uniqueid'] == '8c3200304820d46f0708e329a345189b'])
#Empty DataFrame