Allow for plotting something else than vuositulot as categorical

This commit is contained in:
Aarni Koskela
2021-02-19 16:50:20 +02:00
parent 52114a5f95
commit 41a54d0c6c
2 changed files with 10 additions and 10 deletions

View File

@@ -18,14 +18,12 @@ def set_yaxis_cash(plot):
plot.yaxis[0].formatter = bm.NumeralTickFormatter(format="€0")
def get_categorical_stats_plot(df, *, category, na_as_category=None):
df = get_categorical_stats(
df, category, "Vuositulot", na_as_category=na_as_category
)
def get_categorical_stats_plot(df, *, category, value, na_as_category=None):
df = get_categorical_stats(df, category, value, na_as_category=na_as_category)
df.reset_index(inplace=True)
df[category] = df[category].astype("category")
plot = bp.figure(
title=f"{category}/tulot", x_range=list(df[category].cat.categories)
title=f"{category}/{value}", x_range=list(df[category].cat.categories)
)
set_yaxis_cash(plot)
plot.vbar(