You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/07/23 03:34:18 UTC

[GitHub] [incubator-superset] mistercrunch commented on a change in pull request #10389: [WIP] fix: support non-numeric columns in pivot table

mistercrunch commented on a change in pull request #10389:
URL: https://github.com/apache/incubator-superset/pull/10389#discussion_r459197658



##########
File path: superset/viz.py
##########
@@ -771,22 +783,29 @@ def get_data(self, df: pd.DataFrame) -> VizData:
         if self.form_data.get("granularity") == "all" and DTTM_ALIAS in df:
             del df[DTTM_ALIAS]
 
-        aggfunc = self.form_data.get("pandas_aggfunc") or "sum"
-
-        # Ensure that Pandas's sum function mimics that of SQL.
-        if aggfunc == "sum":
-            aggfunc = lambda x: x.sum(min_count=1)
+        metrics = [utils.get_metric_name(m) for m in self.form_data["metrics"]]
+        aggfuncs: Dict[str, Union[str, Callable]] = {}
+        for metric in metrics:

Review comment:
       Would be nice to break this out into a functional method and adding unit tests for it




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org