Question: Assign changes _ by _ country to a table with one row per country that has two columns: the Country name and the Temperature changes
Assign changesbycountry to a table with one row per country that has two columns: the Country name and the Temperature changes statistic computed across all years in our data set for that country. It may be useful to split this process into two steps. The final table's first rows should look like this:
countryavg changesAfghanistanAfrica
Hint: You can use a group method to apply your changes function to each column in the original data set while grouping on each country. See this example from Olympic data below:
Note This temperature dataset has a few peculiarities, such as including Africa in the country column.
:
NORUSA Table.readtableNORUSAcsv
NORUSANUMBERS NORUSA.groupYear'Team' # Number of athletes per year
NORUSANUMBERS
:
YearTeamcountNorwayUnited StatesNorwayUnited StatesNorwayUnited StatesNorwayUnited StatesNorwayUnited States
rows omitted
Now compute the increases decreases for the winter olympics for each team
Below code allows us to group 'Team' across all the years of the Olympics to give the following table.
TeamYear changescount changesNorwayUnited States
Apply this concept to create the table showing net change for each country.
:
NORUSANUMBERS.groupTeamchanges
:
TeamYear changescount changesNorwayUnited States
:
changesbycountry
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
