From 9496bbcffd9d39da29bef79a17d446bbfb274a79 Mon Sep 17 00:00:00 2001 From: Lionel MASSOULARD Date: Wed, 27 May 2020 17:30:52 +0200 Subject: [PATCH] fix bug when few different values (#52) --- aikit/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aikit/plot.py b/aikit/plot.py index c708a05..f9986c7 100644 --- a/aikit/plot.py +++ b/aikit/plot.py @@ -152,7 +152,7 @@ def conditional_boxplot(df, var, explaining_var, nb_quantiles=10, use_rank=True, var_bis = var explaining_var_bis = explaining_var - df_copy["_quantile"] = pd.qcut(df_copy[explaining_var_bis], q=nb_quantiles) + df_copy["_quantile"] = pd.qcut(df_copy[explaining_var_bis], q=nb_quantiles, duplicates="drop") positions = [np.median(sub_df[explaining_var_bis].values) for _, sub_df in df_copy.groupby("_quantile")] if use_rank: