AI Features

Select Data From DataFrame

Let's see how to select data from the DataFrame object.

We'll cover the following...

In Index lesson, we have already learned how to use label based indexing with loc, which can index both rows and columns. If you only have to filter rows, a simpler alternative is to use query(). However, [] is also commonly used in addition to query().

Select data by []

We can use pandas indexing to subset the DataFrame. Actually, the condition expression creates a Boolean series, and we can use it to filter the DataFrame.

Ask