Alle Dateien aus dem Pythonkurs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
930 B

#! ./bin/python
#encondig: utf-8
import matplotlib.pyplot as plt
from vornamen_reader import read_vornamen
def plot_geschlecht(vornamen):
bez= ['Mädchen', 'Jungs','divers']
geburten = [vornamen['mädchen'], vornamen['jungs'],vornamen['divers']]
print(f'geburten={geburten}')
farben = ['red','blue','green']
fig, ax = plt.subplots()
print(f'fig={fig}')
print(f'ax={ax}')
ax.bar(bez,geburten,label=bez, color=farben)
ax.set_ylabel('Geburten')
ax.set_title('Geburten nach Geschlecht Wuppertal 2020')
ax.legend(title='Geburten')
plt.show()
if __name__ == '__main__':
vornamen = read_vornamen('./Vornamen_Wuppertal_2020.csv')
jungs= vornamen['jungs']
maedels = vornamen['mädchen']
divers = vornamen['divers']
print(f'Jungs: {jungs}')
print(f'Mädchen: {maedels}')
print(f'divers: {divers}')
# print(f'vornamen={vornamen}')
plot_geschlecht(vornamen)