Filtering and Conditional Selection with Series
Filtering and Conditional Selection with Series Data Science Project
Intro to Pandas for Data Analysis

Filtering and Conditional Selection with Series

In this project we explore the fundamental concepts behind filtering and selection for Pandas series. Learn how to build your own "queries" to gather insights from Pandas series using different boolean and comparison operators.
Start this project
Filtering and Conditional Selection with SeriesFiltering and Conditional Selection with Series
Project Created by

Santiago Basulto

Project Activities

All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.

All our activities include solutions with explanations on how they work and why we chose them.

codevalidated

Select only the Japanese companies

Create a Boolean Array that will select only the Japanese companies in our Series:

  • Sony
  • Hitachi
  • Panasonic

Store the array in the variable japanese_boolean_array.

Using that same array, select the companies from the Series and store them in a different variable named japanese_companies.

codevalidated

Select companies with less than $90,000M in Revenue

Select those companies that have a revenue value less than 90,000, select them in a new variable named less_90_rev.

codevalidated

Select companies with revenue of more than $150,000M

Select those companies that have a revenue value greater than 150,000, select them in a new variable named more_150_rev.

codevalidated

Select companies the companies with the MOST and LESS revenue

Use conditional selection and boolean operators to select the two companies with the MOST and LESS revenue. Store the results in the variable most_and_less_rev. Try to use the .max() and .min() methods of the series.

Visually, it should be:

Note: you could solve this activity using s.loc[["Apple", "Panasonic"]], but that is, obviously, not the point of this activity. Please make sure you're using comparison and boolean operators.

codevalidated

Select companies with revenue between $80,000M and $150,000M

Perform a selection of those companies who's revenue is between $80,000M and $150,000. Store the results of your selection in the variable: between_80_and_150.

Visually, you should select the following companies:

Filtering and Conditional Selection with SeriesFiltering and Conditional Selection with Series
Project Created by

Santiago Basulto

This project is part of

Intro to Pandas for Data Analysis

Explore other projects