Answers for "how to get index of columns in pandas"

3

get column number in dataframe pandas

# PANDAS: get column number from colomn name
dataframe.columns.get_loc("<col_name>")
Posted by: Guest on February-22-2020
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
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

Code answers related to "how to get index of columns in pandas"

Python Answers by Framework

Browse Popular Code Answers by Language