get column number in dataframe pandas
# PANDAS: get column number from colomn name
dataframe.columns.get_loc("<col_name>")
get column number in dataframe pandas
# PANDAS: get column number from colomn name
dataframe.columns.get_loc("<col_name>")
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
how to get index of pandas dataframe python
DataFrame.index
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us