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