CO2 Emissions by Country¶

real world problem¶

As climate change and global warming become more as more prominent, the future of Earth starts to concern many people. Carbon dioxide, a key greenhouse gas that drives glocal climate change, continues to rise every month, and its levels are at a record high. Greenhouse gas concentrations drive complex shifts in the planet's weather and climate systems, encompassing not only the rising average temperatures, but also extreme weather events, shifting wildlife populations and habitats, rising seas, and more. It is imminent we as a society take action to slow the worsening state of Earth. With many countries and companies pledging to becoming carbon neutral by 2030 or 2050, we need to first figure out which countries and from what sources carbon emissions come from in order to tackle this issue.

https://education.nationalgeographic.org/resource/carbon-dioxide-levels-are-record-high-heres-what-you-need-know/

dataset¶

In [1]:
import pandas as pd

# Read CSV file into a DataFrame
df_emissions = pd.read_csv('GCB2022v27_MtCO2_flat.csv')

# clean up data by removing lines with NaN values
df_emissions = df_emissions.dropna()

# display first few rows of DataFrame
print(df_emissions.head())
        Country ISO 3166-1 alpha-3  Year       Total        Coal        Oil  \
3232  Australia                AUS  1990  278.154156  141.879819  88.842090   
3233  Australia                AUS  1991  279.528510  146.082840  88.245572   
3234  Australia                AUS  1992  284.525345  150.051381  87.916828   
3235  Australia                AUS  1993  288.870537  150.098575  90.386578   
3236  Australia                AUS  1994  293.696553  151.376241  91.924087   

            Gas    Cement   Flaring     Other  Per Capita  
3232  34.454816  3.462872  7.272496  2.242063   16.315938  
3233  32.786243  3.183033  7.001201  2.229622   16.184767  
3234  33.970472  2.923411  7.303701  2.359551   16.293502  
3235  35.670002  3.004698  7.136743  2.573941   16.383765  
3236  37.032005  3.484276  6.880148  2.999795   16.494706  
In [2]:
# below is the first row of the DataFrame 
data_0 = df_emissions.iloc[0, :]
data_0
Out[2]:
Country                Australia
ISO 3166-1 alpha-3           AUS
Year                        1990
Total                 278.154156
Coal                  141.879819
Oil                     88.84209
Gas                    34.454816
Cement                  3.462872
Flaring                 7.272496
Other                   2.242063
Per Capita             16.315938
Name: 3232, dtype: object

The data is organized using the following columns: Country (the name of the country), ISO 3166-1 alpha-3 (the three letter code for the country), Year (the year of survey data), Total (the total amount of CO2 emitted by the country in that year), Coal (amount of CO2 emitted by coal in that year), Oil (amount emitted by oil) , Gas (amount emitted by gas) , Cement( amount emitted by cement) , Flaring(flaring emission levels ) and Other( other forms such as industrial processes ). In addition there is also one extra column Per Capita which provides an insight into how much personal carbon dioxide emission is present in each Country per individual.

Full data dictionary is provided below if interested.

In [3]:
# the countries that this dataset encompasses
df_emissions['Country'].unique()
Out[3]:
array(['Australia', 'Austria', 'Belarus', 'Belgium', 'Brazil', 'Bulgaria',
       'Canada', 'China', 'Croatia', 'Cyprus', 'Czech Republic',
       'Denmark', 'Estonia', 'Finland', 'France', 'Germany', 'Greece',
       'Hungary', 'Iceland', 'Ireland', 'Italy', 'Japan', 'Kazakhstan',
       'Latvia', 'Liechtenstein', 'Lithuania', 'Luxembourg', 'Malta',
       'Netherlands', 'New Zealand', 'Norway', 'Poland', 'Portugal',
       'South Korea', 'Romania', 'Russia', 'Slovakia', 'Slovenia',
       'Spain', 'Sweden', 'Switzerland', 'Taiwan', 'Turkey', 'Ukraine',
       'United Kingdom', 'USA', 'Global'], dtype=object)

The dataset includes information on a lot of the major countries in the world, so it could be interesting to see how these key players in the economy compare/contrast against each other in emissions.

In [4]:
# the years that this dataset encompasses
years = df_emissions['Year'].unique()
print(years)
print(years.max())
print(years.min())
[1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003
 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017
 2018 2019 2020 2021 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969
 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983
 1984 1985 1986 1987 1988 1989 1904 1905 1906 1907 1908 1909 1910 1911
 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925
 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939
 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953
 1954 1955 1956 1957 1958 1959]
2021
1904

This dataset encompasses emissions trackings from 1904-2021, so there definitely is a wide range of data we could look at, and we could evaluate how the CO2 emissions have progressed over the years, what years categorized the most increase in emissions, and what the possible reasoning for that could be based on historical events.

In [5]:
# describe the Total emissions data
df_emissions['Total'].describe()
Out[5]:
count     1619.000000
mean      1187.296340
std       4348.889189
min          0.141996
25%         38.908676
50%        111.280674
75%        459.921985
max      37123.850352
Name: Total, dtype: float64

We could evaluate the total emissions and emissions by category to see the difference in how different countries produce more/less CO2.

solve problem¶

This dataset can be used to quantify CO2 emisison levels by country over time and understand the sources of these emissions can be valuable. And with insights from this dataset, we can begin to identify strategies to combat climate change through mitigating pollutants.

data dictionary¶

In [7]:
# turn csv values into a data dictionary
data_dict = df_emissions.to_dict(orient='list')
In [ ]: