# Mini-Project B3:
## On methodology
<!-- Put the link to this slide here so people can follow -->
- Sally, Magnus, Emilio and Jonathan
---
# Why the how?
*Very good question*
---
## Step 1
- The dataset
![](https://i.imgur.com/Ugqde5d.png) 20.814 rows later ![](https://i.imgur.com/O7EfQ69.png)
---
## Step 2
- Moving to pandas
``` python=
import pandas as pd
co2_df = pd.read_csv("./co2_emission.csv")
print(co2_df)
```
![](https://i.imgur.com/MlzF5sZ.png)
---
## Step 3
- Dirty data?
```python=
print(co2_df.isnull().sum())
```
![](https://i.imgur.com/JNQJCAI.png)
----
#### Step 3.5
:bath:
- Cleaning data
```python=
co2_df_noCode = co2_df.drop(labels="Code", axis=1)
print(co2_df_noCode)
```
![](https://i.imgur.com/DBiukaX.png)
---
## Step 4
- Visualizing the data
```python=
def make_graph(country):
title = country + " Co2 Emissions"
co2_df_country = co2_df[co2_df["Entity"] == country]
co2_df_country.plot(
x="Year",
y="Annual CO₂ emissions (tonnes )",
title=title
)
make_graph("Denmark")
```
----
## Step 4.5
- The graph for Denmark
![](https://i.imgur.com/6WVq7xv.png)
---
## Step 5
- Going worldwide
```python=
def graph_world():
hasOccured = [];
for country in co2_df["Entity"]:
if(country in hasOccured):
continue
else:
hasOccured.append(country)
for country in hasOccured:
make_graph(country)
graph_world()
```
----
![](https://i.imgur.com/bdGonOO.gif)
#### Now what?
---
## Step 6
- Understanding the visualization
```python=
make_graph("World")
```
![](https://i.imgur.com/VA100pH.png)
le10?
----
- The data
```python=
co2_df_world = co2_df[co2_df["Entity"] == "World"]
print(co2_df_world)
```
![](https://i.imgur.com/2iQ5cuH.png)
3.615326e+10?
----
![](https://i.imgur.com/DmCe7m9.png =500x)
##### The highest annual worldwide emission of CO~2~ > People alive today
:shocked_face_with_exploding_head:
---
## Step 6.5
- What about Denmark?
![](https://i.imgur.com/6WVq7xv.png)
----
```python=
co2_df_dk = co2_df[co2_df["Entity"] == "Denmark"]
co2_df_dk_highest = co2_df_dk.sort_values(
by=['Annual CO₂ emissions (tonnes )'],
ascending=False
)
print(co2_df_dk_highest)
```
![](https://i.imgur.com/oqgDzzn.jpg)
![](https://i.imgur.com/NyqTCTa.png)
##### How many cars would it take to produce that much CO~2~?
----
> "A typical passenger vehicle emits about ==4.6 metric tons== of carbon dioxide per year"
([epa.gov](https://https://www.epa.gov/greenvehicles/greenhouse-gas-emissions-typical-passenger-vehicle), 2018)
----
$\frac{74877499.12}{4.6} = 16.277.717,2$
![](https://i.imgur.com/UjYHF6I.png)
##### It would take ==16 million cars== to produce the amount of CO~2~ emitted in Denmark in 1996
----
#### Which correlates to about 3 times the amount of people in Denmark in 1996
![](https://i.imgur.com/ieGlxUC.png)
:thinking_face:
{"metaMigratedAt":"2023-06-15T14:53:59.606Z","metaMigratedFrom":"YAML","title":"Mini-Project B3","breaks":true,"description":"View the slide with \"Slide Mode\".","contributors":"[{\"id\":\"57d772a1-6bfb-4356-8ecc-f56249314ac6\",\"add\":8553,\"del\":5530},{\"id\":\"dd497130-207f-4e30-987c-a4371c29f4c6\",\"add\":13,\"del\":11},{\"id\":\"8e2a5197-b067-486a-b336-67a1bcf30dae\",\"add\":18,\"del\":0}]"}