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 2022/02/17 09:20:29 UTC

[GitHub] [superset] villebro commented on a change in pull request #18779: fix: contribution operator and refactor unittest

villebro commented on a change in pull request #18779:
URL: https://github.com/apache/superset/pull/18779#discussion_r808829855



##########
File path: superset/utils/pandas_postprocessing/contribution.py
##########
@@ -71,5 +73,7 @@ def contribution(
     numeric_df = numeric_df[columns]
     axis = 0 if orientation == PostProcessingContributionOrientation.COLUMN else 1
     numeric_df = numeric_df / numeric_df.values.sum(axis=axis, keepdims=True)
+    # replace infinity and nan with 0 in dataframe
+    numeric_df.replace(to_replace=[np.Inf, -np.Inf, np.nan], value=0, inplace=True)

Review comment:
       Are we sure we want to display infinities as 0? I think having `1/0` to result in `null` to be more intuitive. I assume keeping infinities as null would cause a break in the chart as opposed to it dropping to zero, which IMO feels more intuitive.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

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