You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by er...@apache.org on 2020/06/09 17:14:11 UTC
[incubator-superset] branch master updated: fix(SankeyViz): enforce
source/target order (#10003)
This is an automated email from the ASF dual-hosted git repository.
erikrit 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 280b4dc fix(SankeyViz): enforce source/target order (#10003)
280b4dc is described below
commit 280b4dce001ac80801fe5cad2aa72935944dc621
Author: serenajiang <se...@berkeley.edu>
AuthorDate: Tue Jun 9 10:13:48 2020 -0700
fix(SankeyViz): enforce source/target order (#10003)
* fix(SankeyViz): enforce source/target order
* address pr comments
* black
Co-authored-by: serena-jiang <se...@airbnb.com>
---
superset/viz.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/superset/viz.py b/superset/viz.py
index d34405c..90d89eb 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -1729,7 +1729,11 @@ class SankeyViz(BaseViz):
return qry
def get_data(self, df: pd.DataFrame) -> VizData:
- df.columns = ["source", "target", "value"]
+ source, target = self.groupby
+ (value,) = self.metric_labels
+ df.rename(
+ columns={source: "source", target: "target", value: "value",}, inplace=True,
+ )
df["source"] = df["source"].astype(str)
df["target"] = df["target"].astype(str)
recs = df.to_dict(orient="records")