Syntax Brief Quetion

These are the instructions:
Confirm that the REGION column is missing from the 2017 data. Recall that there are 164 rows for the year 2017.

  • Select just the rows in combined in which the YEAR column equals 2017. Then, select just the REGION column. Assign the result to regions_2017 .
  • Use the Series.isnull() and Series.sum() to calculate the total number of missing values in regions_2017 , the REGION column for 2017. Assign the result to missing .

This is the answer of this part:

why does combined goes twice in the answer?

hi @federico1

These posts might be helpful. Do let us know if they are not:

  1. Understanding when to use the dataframe name twice?

  2. Boolean Indexing

  3. related to a different query but still has some explanation. Exploring Data with pandas: Fundamental (Page 12) Using value_count

To guide you towards the explanation: I encourage you to try breaking it down and testing it to understand. First, I would start with assigning combined[“YEAR”]==2017 and checking the output. Then assigning and checking combined[combined[“YEAR”]==2017]. Rucha’s post and a quick Google Search on Boolean indexing in Python will help.