Allow remapping nans to a category

This commit is contained in:
Aarni Koskela
2021-02-19 15:38:45 +02:00
parent 483d193d4d
commit 8ffa8badf4
2 changed files with 16 additions and 4 deletions

View File

@@ -16,8 +16,10 @@ def set_yaxis_cash(plot):
plot.yaxis[0].formatter = bm.NumeralTickFormatter(format="€0")
def get_categorical_stats_plot(df, *, category):
df = get_categorical_stats(df, category, "Vuositulot")
def get_categorical_stats_plot(df, *, category, na_as_category=None):
df = get_categorical_stats(
df, category, "Vuositulot", na_as_category=na_as_category
)
df.reset_index(inplace=True)
df[category] = df[category].astype("category")
plot = bp.figure(