AI engineering glossary · NumPy pandas visualization
What is loc?
loc (also called label-based indexing): The pandas accessor that selects rows and columns by their labels. Slices made this way include both end labels, and it also accepts Boolean masks, which makes it the standard tool for filtering rows and setting values safely.
loc: an example
df.loc[df['age'] > 30, 'name'] returns the names of everyone older than 30.
Related terms
More NumPy pandas visualization terms
Where you learn it
loc is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.