I want to remove rows where multiple columns have the same values. I read this question about two columns and tried to extend to multiple columns, however I get an error.
Here is some sample data, similar to my dataframe:
import pandas as pd
data = [['table1',10,8,7],['table2',3,3,3],['table3',3,8,11],['table4',12,12,12],['table5',13,15,5]]
df = pd.DataFrame(data,columns=['table_name','Attr1','Attr2','Attr3'])
and my desired result
res = [['table1',10,8,7],['table3',3,8,11],['table5',13,15,5]]
result = pd.DataFrame(res,columns=['table_name','Attr1','Attr2','Attr3'])
I tried
[df[df['Attr1'] != df['Attr2'] | df['Attr1'] != df['Attr3'] | df['Attr2'] != df['Attr3']]]
which retrieves the error
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Any ideas?