Find if column contains a certain value in panda
Example I have a dataframe with the following columns:
import pandas as pd
df = pd.DataFrame({
'A': [1, 4, 7, 1, 4],
'B': [2, 5, 8, 2, 5],
'C': [3, 6, 9, 3, 6]
})
Data when represented in Table format is:
A | B | C | |
0 | 1 | 2 | 3 |
1 | 4 | 5 | 6 |
2 | 7 | 8 | 9 |
4 | 1 | 2 | 3 |
5 | 4 | 5 | 6 |
Now I want to find the index of the column that contains the value 5.
How to find the index of column?