From 84d4a885c54594031f4325c2db0f7f3b0157cec1 Mon Sep 17 00:00:00 2001 From: Yongjie Zhao Date: Wed, 19 May 2021 17:56:23 +0800 Subject: [PATCH] fix: reindex when combine metric in legacy pivot table --- superset/viz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/viz.py b/superset/viz.py index 680f887a2907a..53ea2ca4deef5 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -936,7 +936,7 @@ def get_data(self, df: pd.DataFrame) -> VizData: # Display metrics side by side with each column if self.form_data.get("combine_metric"): - df = df.stack(0).unstack() + df = df.stack(0).unstack().reindex(level=-1, columns=metrics) return dict( columns=list(df.columns), html=df.to_html(