#!/usr/bin/env python3 from pandas import read_csv import matplotlib.pyplot as plt import matplotlib.ticker as mtick import matplotlib as mpl mpl.rcParams['figure.dpi'] = 1200 import numpy as np import pathlib class display: def __init__(self, filename) -> None: """Start the actual import process. Seperates process and setup.""" with open(filename, mode='r', encoding='utf-8-sig', newline='') as csv_file: reader = read_csv(csv_file) plt.style.use('_mpl-gallery') for style in ["nom", "real", "realeff"]: fig, ax = plt.subplots(figsize=(12, 6)) ob1 = np.asarray(reader[f"{style}tax2014"].dropna()) ob2 = np.asarray(reader[f"{style}tax2015"].dropna()) ob3 = np.asarray(reader[f"{style}tax2016"].dropna()) ob4 = np.asarray(reader[f"{style}tax2017"].dropna()) ob5 = np.asarray(reader[f"{style}tax2018"].dropna()) ob6 = np.asarray(reader[f"{style}tax2019"].dropna()) ob7 = np.asarray(reader[f"{style}tax2020"].dropna()) ob8 = np.asarray(reader[f"{style}tax2021"].dropna()) ob9 = np.asarray(reader[f"{style}tax2022"].dropna()) ob10 = np.asarray(reader[f"{style}tax2023"].dropna()) ob11 = np.asarray(reader[f"{style}tax2024"].dropna()) x = [ob1, ob2, ob3, ob4, ob5, ob6, ob7, ob8, ob9, ob10, ob11] ax.boxplot(x, positions=[2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024], patch_artist=True, showmeans=False, showfliers=False, medianprops={"color": "white", "linewidth": 0.5}, boxprops={"facecolor": "C0", "edgecolor": "white", "linewidth": 0.5}, whiskerprops={"color": "C0", "linewidth": 1.5}, capprops={"color": "C0", "linewidth": 1.5}) ax.yaxis.set_major_formatter(mtick.PercentFormatter(1,0)) plt.show() display(pathlib.Path('/home/user/bachelorarbeit_importer/data/', 'cleaned_st2.csv'))