This is an automated email from the ASF dual-hosted git repository. villebro pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push: new 9a5d812 fix: pie chart multiple groupbys (#10391) 9a5d812 is described below commit 9a5d812ee608fc07d3c0303deee88cd20bc92125 Author: Ville Brofeldt <33317356+ville...@users.noreply.github.com> AuthorDate: Thu Jul 23 09:22:48 2020 +0300 fix: pie chart multiple groupbys (#10391) --- superset/viz.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/superset/viz.py b/superset/viz.py index 8bceef6..6ce4d5a 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -1527,10 +1527,10 @@ class DistributionPieViz(NVD3Viz): if df.empty: return None metric = self.metric_labels[0] - df = df.pivot_table(index=self.groupby, values=[metric]) - df.sort_values(by=metric, ascending=False, inplace=True) - df = df.reset_index() - df.columns = ["x", "y"] + df = pd.DataFrame( + {"x": df[self.groupby].agg(func=", ".join, axis=1), "y": df[metric]} + ) + df.sort_values(by="y", ascending=False, inplace=True) return df.to_dict(orient="records")