1# PANDAS: get column number from colomn name
2dataframe.columns.get_loc("<col_name>")
3
1df = pd.read_csv('thanksgiving_w_age_income.csv')
2
3# Obtain Column Indices:
4gravy = df.columns.get_loc("Do you typically have gravy?")
5meet_friends = df.columns.get_loc('Have you ever tried to meet up with hometown friends on Thanksgiving night?')
6friendsgiving = df.columns.get_loc('Have you ever attended a "Friendsgiving?"')