1In [45]: df = DataFrame({"pear": [1,2,3], "apple": [2,3,4], "orange": [3,4,5]})
2
3In [46]: df.columns
4Out[46]: Index([apple, orange, pear], dtype=object)
5
6In [47]: df.columns.get_loc("pear")
7Out[47]: 2
8
1In [48]: a
2Out[48]:
3 c1 c2
40 0 1
51 2 3
62 4 5
73 6 7
84 8 9
9
10In [49]: a.c1[a.c1 == 8].index.tolist()
11Out[49]: [4]
1import pandas as pd
2
3df = pd.DataFrame(
4 [[88, 72, 67],
5 [23, 78, 62],
6 [55, 54, 76]],
7 index=[2, 4, 9],
8 columns=['a', 'b', 'c'])
9
10index = df.index
11print(index)