Is Data in ...? | Extract Data

# Is Data in ...?

In this section, we will continue extracting data using specific conditions. Here, you will become familiar with the helpful function called `.isin()`. But firstly, you need to examine the dataset. Look at the first five rows:

Now, take a look at the example and the explanation below:

Explanation:

If you remember, we always put the conditions inside the `.loc[]` function. Here, we do the same. The `.isin(list)` function checks if the values from the column are in the array. In our case, we check if values from the column `'Manufacturer'` are in the list `models`.

Tarea

Your task here is to extract data about cars where values from the column `'Color'` are equal to `'Grey'`, `'White'`, `'Black'`. Follow the algorithm to easily manage with the task:

1. Create the `colors` list with the elements `'Grey'`, `'White'`, `'Black'` (in this order).
2. Extract values from the column `'Color'` that the list `color` consists of. Use the `.loc[]` function.
3. Output the last five rows of the dataset `data_extracted`.

¿Todo estuvo claro?

Sección 3. Capítulo 1

Contenido del Curso

# Is Data in ...?

In this section, we will continue extracting data using specific conditions. Here, you will become familiar with the helpful function called `.isin()`. But firstly, you need to examine the dataset. Look at the first five rows:

Now, take a look at the example and the explanation below:

Explanation:

If you remember, we always put the conditions inside the `.loc[]` function. Here, we do the same. The `.isin(list)` function checks if the values from the column are in the array. In our case, we check if values from the column `'Manufacturer'` are in the list `models`.

Tarea

Your task here is to extract data about cars where values from the column `'Color'` are equal to `'Grey'`, `'White'`, `'Black'`. Follow the algorithm to easily manage with the task:

1. Create the `colors` list with the elements `'Grey'`, `'White'`, `'Black'` (in this order).
2. Extract values from the column `'Color'` that the list `color` consists of. Use the `.loc[]` function.
3. Output the last five rows of the dataset `data_extracted`.

¿Todo estuvo claro?

Sección 3. Capítulo 1