Last active
June 19, 2021 15:49
-
-
Save niftycode/b39a9c86c57324bbbbae18071c82a176 to your computer and use it in GitHub Desktop.
Traffic Accidents in Kiel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
""" | |
kiel_unfaelle.py | |
version: 1.3 | |
last edited: June 19th, 2021 | |
The data is provided by the City of Kiel, Germany: | |
http://kiel.de/rathaus/statistik/open_data/index.php?id=de-sh-kiel_gesetze_justiz_strassenverkehsunfaelle_verkehrstote_verletzte_fahrerflucht | |
""" | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
fig, ax = plt.subplots() | |
df = pd.read_csv("kiel_unfaelle.csv", sep=";") | |
# print the first five rows | |
print(df.head()) | |
x = df['Jahr'] | |
y = df['Unfaelle'] | |
plt.title("Traffic Accidents in Kiel", size="x-large") | |
plt.ylabel("Quantity", size="x-large") | |
plt.xlabel("Year", size="x-large") | |
plt.plot(y, "*-", markersize=6, linewidth=1, color='b', label="Traffic Accidents") | |
plt.legend(loc=(0.4, 0.8)) | |
ax.set_xticks(range(len(x))) | |
ax.set_xticklabels(x, rotation='vertical') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment