I want to compare two columns with value (1) and list rows that satisfy this condition. Here is my code:
import pandas as pd
df = pd.DataFrame({'col':[0,1,1,0,1],
'col2':[0,1,0,1,0],
'ord':[0,1,2,3,4]
})
df1 = df.loc[df['col'] == 1 & df['col2'] == 1]
print(df1)
Expected output:
col col2 ord
0 1 1 1