Answers for "selecting column by index pandas"

SQL
3

slicing in pandas

# iloc[row slicing, column slicing]
surveys_df.iloc[0:3, 1:4]
Posted by: Guest on July-16-2020
1

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?"')
Posted by: Guest on April-12-2021

Code answers related to "selecting column by index pandas"

Code answers related to "SQL"

Browse Popular Code Answers by Language