Answers for "get index of dataframe"

3

find index of pandas column

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
Posted by: Guest on January-27-2021
5

finding the index of an element in a pandas df

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]
Posted by: Guest on September-18-2020
1

get index of dataframe

df.index
Posted by: Guest on August-13-2021
1

how to get index of pandas dataframe python

DataFrame.index
Posted by: Guest on August-05-2021
1

get index number pandas dataframe

df.index[df['BoolCol'] == True].tolist()
Posted by: Guest on January-12-2021
1

accessing index of dataframe python

# For accessing dataframe index:
df.index
# For retrieving dataframe index as list:
df.index.tolist()
# for accessing value for an index:
df.at[index_value, column_value]
Posted by: Guest on July-12-2021

Code answers related to "get index of dataframe"

Browse Popular Code Answers by Language