Visualisierung#

Ziel#

Wir visualisieren die Daten im EM-DAT Datensatz

Datenpipeline

# Install a pip package im Jupyter Notebook
!pip3 install pandas
Requirement already satisfied: pandas in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (2.1.3)
Requirement already satisfied: numpy<2,>=1.23.2 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from pandas) (1.26.2)
Requirement already satisfied: python-dateutil>=2.8.2 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from pandas) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from pandas) (2023.3.post1)
Requirement already satisfied: tzdata>=2022.1 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from pandas) (2023.3)
Requirement already satisfied: six>=1.5 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)
import pandas as pd
data = pd.read_csv('../../data/clean_emdat.csv', index_col=0)
data
Year Country Disaster Subroup Disaster Type Disaster Subtype Total Events Total Affected Total Deaths Total Damage (USD, original) CPI
1 2000 Afghanistan Climatological Drought Drought 1 2580000.0 37.0 50000.0 58.840648
2 2000 Algeria Hydrological Flood Flash flood 2 105.0 37.0 NaN 58.840648
3 2000 Algeria Hydrological Flood Flood (General) 2 100.0 7.0 NaN 58.840648
4 2000 Algeria Meteorological Storm Storm (General) 1 10.0 4.0 NaN 58.840648
5 2000 Angola Hydrological Flood Flood (General) 3 9011.0 15.0 NaN 58.840648
... ... ... ... ... ... ... ... ... ... ...
5834 2023 Viet Nam Meteorological Storm Tropical cyclone 1 3.0 1.0 NaN NaN
5835 2023 Yemen Hydrological Flood Flood (General) 1 169035.0 39.0 NaN NaN
5836 2023 Zambia Hydrological Flood Flash flood 1 154608.0 0.0 NaN NaN
5837 2023 Zambia Hydrological Flood Flood (General) 1 22000.0 0.0 NaN NaN
5838 2023 Zimbabwe Meteorological Storm Tropical cyclone 1 2.0 2.0 NaN NaN

5838 rows × 10 columns

data.info()
<class 'pandas.core.frame.DataFrame'>
Index: 5838 entries, 1 to 5838
Data columns (total 10 columns):
 #   Column                        Non-Null Count  Dtype  
---  ------                        --------------  -----  
 0   Year                          5838 non-null   int64  
 1   Country                       5838 non-null   object 
 2   Disaster Subroup              5838 non-null   object 
 3   Disaster Type                 5838 non-null   object 
 4   Disaster Subtype              5838 non-null   object 
 5   Total Events                  5838 non-null   int64  
 6   Total Affected                5838 non-null   float64
 7   Total Deaths                  5838 non-null   float64
 8   Total Damage (USD, original)  2032 non-null   float64
 9   CPI                           5648 non-null   float64
dtypes: float64(4), int64(2), object(4)
memory usage: 501.7+ KB

Das Dashboard…#

Recherchefragen#

  • Wie viele Todesopfer gibt es in einem Land?

  • Wie stark ist ein Land von Naturkatastrophen betroffen?

  • Welchen Anteil haben die unterschiedlichen Naturkatastrophentypen daran?

  • Wie hat sich die Anzahl der Naturkatastrophen über die Jahre hin entwickelt?

Wie viele Todesopfer gibt es in einem Land?#

Wie viele Todesopfer gibt es insgesamt?#

data["Total Deaths"].sum()
1416055.0

Wie viele Todesopfer gibt es insgesamt in Deutschland?#

data['Country'] == 'Germany'
1       False
2       False
3       False
4       False
5       False
        ...  
5834    False
5835    False
5836    False
5837    False
5838    False
Name: Country, Length: 5838, dtype: bool
data[data['Country'] == 'Germany']
Year Country Disaster Subroup Disaster Type Disaster Subtype Total Events Total Affected Total Deaths Total Damage (USD, original) CPI
370 2001 Germany Meteorological Storm Lightning/Thunderstorms 1 6.0 6.0 3.000000e+08 60.503579
636 2002 Germany Hydrological Flood Flood (General) 1 330108.0 27.0 1.160000e+10 61.463188
637 2002 Germany Meteorological Storm Extra-tropical storm 1 11.0 11.0 1.800000e+09 61.463188
638 2002 Germany Meteorological Storm Storm (General) 2 19.0 11.0 2.500000e+08 61.463188
929 2003 Germany Meteorological Extreme temperature Heat wave 1 9355.0 9355.0 1.650000e+09 62.858460
930 2003 Germany Meteorological Storm Extra-tropical storm 1 5.0 5.0 3.000000e+08 62.858460
931 2003 Germany Meteorological Storm Lightning/Thunderstorms 1 10.0 10.0 NaN 62.858460
1163 2004 Germany Geophysical Earthquake Ground movement 1 150.0 0.0 1.200000e+07 64.541329
1164 2004 Germany Meteorological Storm Storm (General) 1 2.0 2.0 1.300000e+08 64.541329
1434 2005 Germany Hydrological Flood Riverine flood 2 450.0 1.0 2.200000e+08 66.731058
1435 2005 Germany Meteorological Extreme temperature Cold wave 1 165.0 1.0 3.000000e+08 66.731058
1436 2005 Germany Meteorological Storm Extra-tropical storm 1 2.0 2.0 2.700000e+08 66.731058
1694 2006 Germany Hydrological Flood Riverine flood 1 1000.0 0.0 NaN 68.883759
1695 2006 Germany Meteorological Extreme temperature Heat wave 1 2.0 2.0 NaN 68.883759
1696 2006 Germany Meteorological Extreme temperature Severe winter conditions 1 10.0 10.0 NaN 68.883759
1697 2006 Germany Meteorological Storm Hail 1 100.0 1.0 NaN 68.883759
1698 2006 Germany Meteorological Storm Storm (General) 2 200.0 10.0 NaN 68.883759
1948 2007 Germany Hydrological Flood Riverine flood 1 1.0 1.0 NaN 70.848793
1949 2007 Germany Meteorological Storm Blizzard/Winter storm 1 7.0 7.0 NaN 70.848793
1950 2007 Germany Meteorological Storm Extra-tropical storm 1 130.0 11.0 5.500000e+09 70.848793
2205 2008 Germany Meteorological Storm Extra-tropical storm 1 5.0 5.0 1.200000e+09 73.568746
2206 2008 Germany Meteorological Storm Severe weather 1 3.0 3.0 1.500000e+09 73.568746
2435 2009 Germany Hydrological Flood Riverine flood 1 0.0 0.0 2.000000e+07 73.307177
2436 2009 Germany Meteorological Extreme temperature Cold wave 2 15.0 15.0 NaN 73.307177
2437 2009 Germany Meteorological Storm Lightning/Thunderstorms 1 1.0 1.0 5.000000e+07 73.307177
2668 2010 Germany Hydrological Flood Flash flood 1 3.0 3.0 NaN 74.509444
2669 2010 Germany Meteorological Extreme temperature Cold wave 1 1.0 1.0 NaN 74.509444
2670 2010 Germany Meteorological Storm Blizzard/Winter storm 1 0.0 0.0 NaN 74.509444
2671 2010 Germany Meteorological Storm Extra-tropical storm 1 4.0 4.0 1.000000e+09 74.509444
2907 2011 Germany Hydrological Flood Riverine flood 1 4.0 4.0 NaN 76.861595
3128 2012 Germany Meteorological Extreme temperature Cold wave 2 6.0 6.0 NaN 78.452114
3334 2013 Germany Hydrological Flood Riverine flood 1 6350.0 4.0 1.290000e+10 79.601309
3335 2013 Germany Meteorological Storm Extra-tropical storm 2 2.0 7.0 NaN 79.601309
3336 2013 Germany Meteorological Storm Hail 1 0.0 0.0 4.800000e+09 79.601309
3528 2014 Germany Meteorological Storm Lightning/Thunderstorms 2 1.0 8.0 4.000000e+08 80.892624
3987 2016 Germany Hydrological Flood Flood (General) 1 7.0 7.0 2.000000e+09 82.010331
4219 2017 Germany Hydrological Flood Riverine flood 1 600.0 0.0 NaN 83.757255
4220 2017 Germany Meteorological Storm Hail 1 2.0 2.0 7.400000e+08 83.757255
4221 2017 Germany Meteorological Storm Severe weather 1 24.0 3.0 1.590000e+08 83.757255
4448 2018 Germany Meteorological Extreme temperature Heat wave 1 0.0 0.0 NaN 85.803026
4449 2018 Germany Meteorological Storm Extra-tropical storm 1 12.0 5.0 5.884750e+08 85.803026
4694 2019 Germany Meteorological Extreme temperature Heat wave 2 4.0 4.0 NaN 87.358007
4695 2019 Germany Meteorological Storm Blizzard/Winter storm 1 1.0 1.0 NaN 87.358007
4934 2020 Germany Meteorological Storm Extra-tropical storm 1 33.0 0.0 NaN 88.435641
5194 2021 Germany Hydrological Flood Flood (General) 1 1000.0 197.0 4.000000e+10 92.590193
5195 2021 Germany Meteorological Storm Lightning/Thunderstorms 1 600.0 0.0 NaN 92.590193
5196 2021 Germany Meteorological Storm Storm (General) 1 4.0 1.0 NaN 92.590193
5461 2022 Germany Meteorological Extreme temperature Heat wave 1 8173.0 8173.0 NaN 100.000000
5462 2022 Germany Meteorological Storm Extra-tropical storm 3 2.0 7.0 1.023156e+09 100.000000
5707 2023 Germany Meteorological Storm Severe weather 1 1.0 1.0 NaN NaN
data[data['Country'] == 'Germany']['Total Deaths'].sum()
17935.0
data_germany = data[data['Country'] == 'Germany']
data_germany['Total Deaths'].sum()
17935.0

Wie viele Todesopfer gab es insgesamt in Indien?#

data_land = data[data['Country'] == 'India']
data_land['Total Deaths'].sum()
87391.0

Allgemeine Funktion die Gesamtzahl der Todesopfer eines Landes ausgibt#

def get_total_deaths(data, country):
    data_land = data[data['Country'] == country]
    return data_land['Total Deaths'].sum()
get_total_deaths(data, 'Japan')
23066.0
get_total_deaths(data, 'Sweden')
56.0
get_total_deaths(data, 'South Africa')
1311.0

Dashboard Teil II#

Welchen Anteil haben die unterschiedlichen Naturkatastrophentypen in Deutschland?#

germany_data = data[data['Country'] == 'Germany']
germany_data['Disaster Type'].value_counts(normalize=True)
Disaster Type
Storm                  0.56
Flood                  0.22
Extreme temperature    0.20
Earthquake             0.02
Name: proportion, dtype: float64

Visualisierung von DataFrames#

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python.

Matplotlib makes easy things easy and hard things possible.

Install matplotlib:

!pip3 install --upgrade pip
!pip3 install --upgrade Pillow
!pip3 install matplotlib

import matplotlib.pyplot as plt
Requirement already satisfied: pip in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (23.3.1)
Requirement already satisfied: Pillow in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (10.1.0)
Requirement already satisfied: matplotlib in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (3.8.2)
Requirement already satisfied: contourpy>=1.0.1 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from matplotlib) (1.2.0)
Requirement already satisfied: cycler>=0.10 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from matplotlib) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from matplotlib) (4.46.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from matplotlib) (1.4.5)
Requirement already satisfied: numpy<2,>=1.21 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from matplotlib) (1.26.2)
Requirement already satisfied: packaging>=20.0 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from matplotlib) (23.2)
Requirement already satisfied: pillow>=8 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from matplotlib) (10.1.0)
Requirement already satisfied: pyparsing>=2.3.1 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from matplotlib) (3.1.1)
Requirement already satisfied: python-dateutil>=2.7 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from matplotlib) (2.8.2)
Requirement already satisfied: six>=1.5 in /home/natalie/Dokumente/Datenjournalismus in Python/Code/.venv/lib/python3.11/site-packages (from python-dateutil>=2.7->matplotlib) (1.16.0)
germany_data = data[data['Country'] == 'Germany']
germany_data['Disaster Type'].value_counts()
Disaster Type
Storm                  28
Flood                  11
Extreme temperature    10
Earthquake              1
Name: count, dtype: int64
germany_data['Disaster Type'].value_counts().plot(kind='bar')
<Axes: xlabel='Disaster Type'>
../_images/5fbdbe4f6c003d85dc01181609dccc822facd1f63194c4dd766585ee0efcfc71.png
germany_data['Disaster Type'].value_counts().plot(kind='pie')
<Axes: ylabel='count'>
../_images/90b9861ce6542f1404236a538e6798a7aad48cdca6694dac299e190c820dfc20.png

Recherchefragen#

Welche Naturkatastrophen fordern die meisten Todesopfer?#

.groupby() gruppiert einen DataFrame nach den Werten einer oder mehreren Spalten.

Die Spalten nach denen man Gruppieren möchte werden als Argument übergeben. Danach folgt die gewünschte Berechnung auf dieser Gruppe. Das Ergebnis wird als DataFrame zurückgegeben.

data
Year Country Disaster Subroup Disaster Type Disaster Subtype Total Events Total Affected Total Deaths Total Damage (USD, original) CPI
1 2000 Afghanistan Climatological Drought Drought 1 2580000.0 37.0 50000.0 58.840648
2 2000 Algeria Hydrological Flood Flash flood 2 105.0 37.0 NaN 58.840648
3 2000 Algeria Hydrological Flood Flood (General) 2 100.0 7.0 NaN 58.840648
4 2000 Algeria Meteorological Storm Storm (General) 1 10.0 4.0 NaN 58.840648
5 2000 Angola Hydrological Flood Flood (General) 3 9011.0 15.0 NaN 58.840648
... ... ... ... ... ... ... ... ... ... ...
5834 2023 Viet Nam Meteorological Storm Tropical cyclone 1 3.0 1.0 NaN NaN
5835 2023 Yemen Hydrological Flood Flood (General) 1 169035.0 39.0 NaN NaN
5836 2023 Zambia Hydrological Flood Flash flood 1 154608.0 0.0 NaN NaN
5837 2023 Zambia Hydrological Flood Flood (General) 1 22000.0 0.0 NaN NaN
5838 2023 Zimbabwe Meteorological Storm Tropical cyclone 1 2.0 2.0 NaN NaN

5838 rows × 10 columns

data['Total Deaths'].sum()
1416055.0
data.groupby('Disaster Type')['Total Deaths'].sum()
Disaster Type
Animal incident                    12.0
Drought                         23913.0
Earthquake                     785228.0
Extreme temperature            235687.0
Flood                          128317.0
Glacial lake outburst flood       439.0
Impact                              0.0
Infestation                         0.0
Mass movement (dry)               382.0
Mass movement (wet)             19413.0
Storm                          218907.0
Volcanic activity                1711.0
Wildfire                         2046.0
Name: Total Deaths, dtype: float64
data.groupby('Disaster Type').sum()
Year Country Disaster Subroup Disaster Subtype Total Events Total Affected Total Deaths Total Damage (USD, original) CPI
Disaster Type
Animal incident 2014 Niger Biological Animal incident 1 5.000000e+00 12.0 0.000000e+00 80.892624
Drought 772205 AfghanistanArmeniaAzerbaijanBolivia (Plurinati... ClimatologicalClimatologicalClimatologicalClim... DroughtDroughtDroughtDroughtDroughtDroughtDrou... 396 1.651828e+09 23913.0 1.751722e+11 28990.398302
Earthquake 778193 AzerbaijanBangladeshChinaColombiaGreeceIceland... GeophysicalGeophysicalGeophysicalGeophysicalGe... Ground movementGround movementGround movementG... 652 1.398904e+08 785228.0 6.647881e+11 27980.773490
Extreme temperature 896633 ArgentinaBangladeshBelarusBolivia (Plurination... MeteorologicalMeteorologicalMeteorologicalMete... Cold waveCold waveCold waveCold waveCold waveC... 487 9.774977e+07 235687.0 5.086219e+10 33081.773472
Flood 4826898 AlgeriaAlgeriaAngolaAngolaArgentinaArgentinaAu... HydrologicalHydrologicalHydrologicalHydrologic... Flash floodFlood (General)Flood (General)River... 3968 1.782933e+09 128317.0 7.282075e+11 176689.363211
Glacial lake outburst flood 6066 IndiaItalyIndia ClimatologicalClimatologicalClimatological Glacial lake outburst floodGlacial lake outbur... 4 8.843500e+04 439.0 2.100000e+08 192.590193
Impact 2013 Russian Federation Extra-terrestrial Collision 1 3.014910e+05 0.0 3.300000e+07 79.601309
Infestation 58273 AustraliaPeruChinaRussian FederationAustraliaB... BiologicalBiologicalBiologicalBiologicalBiolog... Locust infestationLocust infestationLocust inf... 29 2.800000e+06 0.0 1.200000e+08 2112.085926
Mass movement (dry) 26120 PhilippinesEcuadorChinaChinaColombiaEgyptPapua... GeophysicalGeophysicalGeophysicalGeophysicalGe... Landslide (dry)Landslide (dry)Landslide (dry)L... 13 4.424000e+03 382.0 8.000000e+06 956.344621
Mass movement (wet) 665755 AngolaAustriaAzerbaijanBosnia and HerzegovinaB... HydrologicalHydrologicalHydrologicalHydrologic... Landslide (wet)Avalanche (wet)Avalanche (wet)L... 443 5.124087e+06 19413.0 5.113121e+09 23928.007940
Storm 3037392 AlgeriaArgentinaArgentinaAustraliaAustriaBangl... MeteorologicalMeteorologicalMeteorologicalMete... Storm (General)Blizzard/Winter stormLightning/... 2482 8.144219e+08 218907.0 1.595769e+12 110203.802317
Volcanic activity 209182 GuatemalaJapanMexicoPhilippinesDemocratic Repu... GeophysicalGeophysicalGeophysicalGeophysicalGe... Ash fallAsh fallAsh fallAsh fallAsh fallAsh fa... 123 6.429001e+06 1711.0 3.465433e+09 7814.313176
Wildfire 460576 ArgentinaAustraliaBulgariaCroatiaCyprusEthiopi... ClimatologicalClimatologicalClimatologicalClim... Forest fireLand fire (Brush, Bush, Pasture)For... 294 1.470967e+07 2046.0 1.085216e+11 16594.190195

.groupby() kann auch auf mehrere Spalten gleichzeitig angewendet werden

data.groupby(['Disaster Type', 'Disaster Subtype'])['Total Deaths'].sum()
Disaster Type                Disaster Subtype                
Animal incident              Animal incident                         12.0
Drought                      Drought                              23913.0
Earthquake                   Ground movement                     532498.0
                             Tsunami                             252730.0
Extreme temperature          Cold wave                            11323.0
                             Heat wave                           220684.0
                             Severe winter conditions              3680.0
Flood                        Coastal flood                          606.0
                             Flash flood                          24663.0
                             Flood (General)                      33094.0
                             Riverine flood                       69954.0
Glacial lake outburst flood  Glacial lake outburst flood            439.0
Impact                       Collision                                0.0
Infestation                  Locust infestation                       0.0
                             Worms infestation                        0.0
Mass movement (dry)          Avalanche (dry)                         16.0
                             Landslide (dry)                        247.0
                             Rockfall (dry)                         119.0
Mass movement (wet)          Avalanche (wet)                       1856.0
                             Landslide (wet)                      14504.0
                             Mudslide                              2638.0
                             Rockfall (wet)                         128.0
                             Sudden Subsidence (wet)                287.0
Storm                        Blizzard/Winter storm                 2779.0
                             Derecho                                 24.0
                             Extra-tropical storm                   363.0
                             Hail                                   302.0
                             Lightning/Thunderstorms               2061.0
                             Sand/Dust storm                        316.0
                             Severe weather                        1256.0
                             Storm (General)                      15590.0
                             Storm surge                             52.0
                             Tornado                               2085.0
                             Tropical cyclone                    194079.0
Volcanic activity            Ash fall                               630.0
                             Lava flow                               33.0
                             Pyroclastic flow                       532.0
                             Volcanic activity (General)            516.0
Wildfire                     Forest fire                           1080.0
                             Land fire (Brush, Bush, Pasture)       487.0
                             Wildfire (General)                     479.0
Name: Total Deaths, dtype: float64

Visualisierung#

data.groupby('Disaster Type')['Total Deaths'].sum().plot(kind='pie')
<Axes: ylabel='Total Deaths'>
../_images/2e88f51cf703a3e005b4056a135f182bfad0e693fe55ea50e2c8c28e589ef6b1.png

Welche Naturkatastrophen fordern die meisten Todesopfer in Deutschland?#

germany_data = data[data['Country'] == 'Germany']
germany_data.groupby('Disaster Type')['Total Deaths'].sum().plot(kind='pie')
<Axes: ylabel='Total Deaths'>
../_images/2f30fbfc631328a35042bb44826a412fabdd3ea45bfd38704c917ea05008c376.png

Generelle Funktion#

country = 'India'
country_data = data[data['Country'] == country]
country_data.groupby('Disaster Type')['Total Deaths'].sum().plot(kind='pie')
<Axes: ylabel='Total Deaths'>
../_images/2f724652f3a3e72f341dd5042687904c9e7dbf85616efd9999c7061373e0e61a.png
def plot_death_by_disastertype(data, country):
    country_data = data[data['Country'] == country]
    country_data.groupby('Disaster Type')['Total Deaths'].sum().plot(kind='pie')
plot_death_by_disastertype(data, 'Egypt')
../_images/92c2be512502ca8da83615b81a23f70c7b953185878021f435f50b7202c645c2.png

Dashboard Teil III#

Wie hat sich die Anzahl der Naturkatastrophen über die Jahre hin entwickelt?#

Berechne für jedes Jahr die Summe aus allen Events

data.groupby('Year')['Total Events'].sum()
Year
2000    412
2001    377
2002    421
2003    360
2004    362
2005    430
2006    402
2007    412
2008    353
2009    345
2010    394
2011    333
2012    347
2013    331
2014    322
2015    387
2016    324
2017    344
2018    318
2019    400
2020    400
2021    433
2022    417
2023    269
Name: Total Events, dtype: int64
data['Total Events'].sum()
8893
data.groupby('Year').min()
Country Disaster Subroup Disaster Type Disaster Subtype Total Events Total Affected Total Deaths Total Damage (USD, original) CPI
Year
2000 Afghanistan Biological Drought Ash fall 1 0.0 0.0 35000.0 58.840648
2001 Afghanistan Biological Drought Ash fall 1 0.0 0.0 10000.0 60.503579
2002 Afghanistan Climatological Drought Ash fall 1 0.0 0.0 30000.0 61.463188
2003 Afghanistan Climatological Drought Ash fall 1 0.0 0.0 50000.0 62.858460
2004 Afghanistan Biological Drought Ash fall 1 0.0 0.0 173000.0 64.541329
2005 Afghanistan Climatological Drought Ash fall 1 0.0 0.0 20000.0 66.731058
2006 Afghanistan Biological Drought Ash fall 1 0.0 0.0 500000.0 68.883759
2007 Afghanistan Climatological Drought Ash fall 1 0.0 0.0 9000.0 70.848793
2008 Afghanistan Climatological Drought Ash fall 1 0.0 0.0 29000.0 73.568746
2009 Afghanistan Biological Drought Ash fall 1 0.0 0.0 5000.0 73.307177
2010 Afghanistan Biological Drought Ash fall 1 0.0 0.0 78000.0 74.509444
2011 Afghanistan Climatological Drought Ash fall 1 0.0 0.0 123000.0 76.861595
2012 Afghanistan Climatological Drought Ash fall 1 0.0 0.0 760000.0 78.452114
2013 Afghanistan Climatological Drought Ash fall 1 0.0 0.0 102000.0 79.601309
2014 Afghanistan Biological Animal incident Animal incident 1 0.0 0.0 791000.0 80.892624
2015 Afghanistan Climatological Drought Ash fall 1 0.0 0.0 2000.0 80.988579
2016 Afghanistan Climatological Drought Avalanche (wet) 1 0.0 0.0 50000.0 82.010331
2017 Afghanistan Climatological Drought Ash fall 1 0.0 0.0 1655000.0 83.757255
2018 Afghanistan Climatological Drought Ash fall 1 0.0 0.0 36000.0 85.803026
2019 Afghanistan Biological Drought Ash fall 1 0.0 0.0 4000000.0 87.358007
2020 Afghanistan Biological Drought Ash fall 1 0.0 0.0 1500000.0 88.435641
2021 Afghanistan Climatological Drought Ash fall 1 0.0 0.0 120000.0 92.590193
2022 Afghanistan Climatological Drought Ash fall 1 0.0 0.0 0.0 100.000000
2023 Afghanistan Climatological Drought Ash fall 1 0.0 0.0 1000000.0 NaN
data[['Total Events', 'Year']].groupby('Year')['Total Events'].sum()
Year
2000    412
2001    377
2002    421
2003    360
2004    362
2005    430
2006    402
2007    412
2008    353
2009    345
2010    394
2011    333
2012    347
2013    331
2014    322
2015    387
2016    324
2017    344
2018    318
2019    400
2020    400
2021    433
2022    417
2023    269
Name: Total Events, dtype: int64
yearly_events = data.groupby('Year')['Total Events'].sum()
yearly_events.plot(kind='line', x='Year', y='Total Events', title='Anzahl an Naturkatastrophen pro Jahr')
<Axes: title={'center': 'Anzahl an Naturkatastrophen pro Jahr'}, xlabel='Year'>
../_images/0e43fafc034adc92234657ac61cfc22a60c666ab102d93a3da2b0c64185c6d35.png

Plotte für Deutschland die Entwicklung der Anzahl an Naturkatastrophen über die Jahre hinweg

yearly_events =germany_data.groupby('Year')['Total Events'].sum()
yearly_events.plot(kind='line', x='Year', y='Total Events', title='Anzahl an Naturkatastrophen pro Jahr')
<Axes: title={'center': 'Anzahl an Naturkatastrophen pro Jahr'}, xlabel='Year'>
../_images/9adc34ec5273748d24db7c081c426b68b7ff78a00bd6eba2a78de68ac928f568.png

Generelle Funktion

def plot_evolution(data, country):
    land_data = data[data['Country'] == county]
    yearly_events = land_data.groupby('Year')['Total Events'].sum()
    yearly_events.plot(kind='line', x='Year', y='Total Events', title='Anzahl an Naturkatastrophen pro Jahr')