Exercise

In this set of practice exercises we'll be investigating the carbon footprint of different foods. We'll be leveraging a dataset compiled by Kasia Kulma and contributed to R's Tidy Tuesday project.

Start by importing pandas with the alias pd.

In [2]:
# Your answer here.

Exercise

The dataset we'll be working with has the following columns:

column description
country Country Name
food_category Food Category
consumption Consumption (kg/person/year)
co2_emmission Co2 Emission (Kg CO2/person/year)

Import the dataset as a dataframe named df from this url: https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-02-18/food_consumption.csv

In [4]:
# Your answer here.

Exercise

How many rows and columns are there in the dataframe?

In [5]:
# Your answer here.

4.

What is the type of data in each column of df?

In [6]:
# Your answer here.

5.

What is the mean co2_emission of the whole dataset?

In [6]:
# Your answer here.

6.

How many different kinds of foods are there in the dataset? How many countries are in the dataset?

In [8]:
# Your answer here.

7.

What is the maximum co2_emmission in the dataset and which food type and country does it belong to?

In [8]:
# Your answer here.

8.

How many countries produce more than 1000 Kg CO2/person/year for at least one food type?

In [8]:
# Your answer here.

9.

Which country consumes the least amount of beef per person per year?

In [8]:
# Your answer here.

10.

Which country consumes the most amount of soybeans per person per year?

In [8]:
# Your answer here.

11.

What is the total emissions of all the meat products (Pork, Poultry, Fish, Lamb & Goat, Beef) in the dataset combined?

In [8]:
# Your answer here.

12.

What is the total emissions of all other (non-meat) products in the dataset combined?

In [8]:
# Your answer here.
In [ ]:
!jupyter nbconvert _07-py-pandas-practice.ipynb --to html --template classic --output 07-py-pandas-practice.html

Have fun!