AI engineering glossary · NumPy pandas visualization

What is sort_values?

sort_values (also called sort_index): A pandas method that reorders the rows of a DataFrame by the values in one or more columns, ascending or descending. It returns a new table rather than changing the original unless told to, and is used for rankings and top-N lists.

Level: beginnerTopic: NumPy pandas visualization

sort_values: an example

df.sort_values('revenue', ascending=False).head(5) gives the five highest-revenue rows.

Related terms

More NumPy pandas visualization terms

Where you learn it

sort_values is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.