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>")
get index number pandas dataframe
df.index[df['BoolCol'] == True].tolist()
get column index pandas
df = pd.read_csv('thanksgiving_w_age_income.csv')
# Obtain Column Indices:
gravy = df.columns.get_loc("Do you typically have gravy?")
meet_friends = df.columns.get_loc('Have you ever tried to meet up with hometown friends on Thanksgiving night?')
friendsgiving = df.columns.get_loc('Have you ever attended a "Friendsgiving?"')
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