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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]