Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to subset a dataframe in python based on multiple categorical values

# Select the species and plot columns from the DataFrame
surveys_df[['species_id', 'plot_id']]

# What happens when you flip the order?
surveys_df[['plot_id', 'species_id']]

# What happens if you ask for a column that doesn't exist?
surveys_df['speciess']
Source by datacarpentry.org #
 
PREVIOUS NEXT
Tagged: #subset #dataframe #python #based #multiple #categorical #values
ADD COMMENT
Topic
Name
6+8 =