def plot_defaults_per_country(df: DataFrame): year = dbutils.widgets.get("year") # noqa: F821 rating = dbutils.widgets.get("rating") # noqa: F821 if len(df.head(1)) == 0: return ax = sns.barplot(x="Country", y="Defaults", data=df.toPandas()) ax.set_title(f"Defaults per Country of {rating} rating during {year}") return display(ax) # noqa: F821
def plot_defaults_per_month(df: DataFrame): year = dbutils.widgets.get("year") # noqa: F821 country = dbutils.widgets.get("country") # noqa: F821 rating = dbutils.widgets.get("rating") # noqa: F821 if len(df.head(1)) == 0: return ax = sns.barplot(x="Month", y="Defaults", data=df.toPandas()) ax.set_title(f"Defaults per Month in {year} in {country} of {rating} rating") return display(ax) # noqa: F821