index match multiple columns code example
Example: How to get the positions where values of two columns match?
import pandas as pd
import numpy as np
#1
df.index[df['BoolCol'] == True].tolist()
#2
df.index[df['BoolCol']].tolist()
#ex :
df = pd.DataFrame({'fruit1': np.random.choice(['apple', 'orange', 'banana'], 10),
'fruit2': np.random.choice(['apple', 'orange', 'banana'], 10)})
out = df.index[df.fruit1 == df.fruit2].tolist()