andy-clapson commented on code in PR #29898:
URL: https://github.com/apache/superset/pull/29898#discussion_r1719893542
##########
tests/unit_tests/charts/test_post_processing.py:
##########
@@ -407,6 +407,346 @@ def test_pivot_df_single_row_two_metrics():
)
+def test_pivot_df_single_row_null_values():
+ """
+ Pivot table when a single column and 2 metrics are selected.
+ """
+ df = pd.DataFrame.from_dict(
+ {
+ "gender": {0: "girl", 1: "boy"},
+ "SUM(num)": {0: 118065, 1: None},
+ "MAX(num)": {0: 2588, 1: None},
+ }
+ )
+ assert (
+ df.to_markdown()
+ == """
+| | gender | SUM(num) | MAX(num) |
+|---:|:---------|-----------:|-----------:|
+| 0 | girl | 118065 | 2588 |
+| 1 | boy | nan | nan |
+ """.strip()
+ )
+
+ pivoted = pivot_df(
+ df,
+ rows=["gender"],
+ columns=[],
+ metrics=["SUM(num)", "MAX(num)"],
+ aggfunc="Sum",
+ transpose_pivot=False,
+ combine_metrics=False,
+ show_rows_total=False,
Review Comment:
weirdly, the case I have where i replicate this NULL issue only occurs when
I have one of the column or row total set to True.
--
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]