hughhhh opened a new pull request, #45865:
URL: https://github.com/apache/superset/pull/45865

   ### SUMMARY
   Fixes three issues from a pandas 3.0 chart smoke test:
   
   1. **Box plot `__count` counted NULL values.** `np.ma.count` on a plain 
array counts every element, so rows whose metric is NULL were counted, and a 
group with only NULLs counted its row total. This happens on pandas 2 as well. 
The count uses `Series.count`, which leaves NULLs out.
   2. **Pivot table CSV export with totals showed a blank instead of `nan`.** 
In `pivot_df`, `df[col].replace("SUPERSET_PANDAS_NAN", ..., inplace=True)` is a 
chained inplace call. Under pandas 3 copy-on-write it only updates a copy 
(pandas raises `ChainedAssignmentError` for it), so the `"nan"` text for 
missing cells in non-numeric metric columns never reached the frame. The later 
frame-wide replace turned those cells into `np.nan`, which a CSV writes as 
empty. The result is now assigned back to the column. Totals values were 
already correct.
   3. **Calendar heatmap with "show values" showed `null` on days with no 
data.** cal-heatmap passes `null` for those days, and the number formatter 
renders it as `"null"`. The label is empty for missing values.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Not captured. The calendar change only affects days without data when "Show 
Values" is on: before, the cell read `null`; after, it is empty.
   
   ### TESTING INSTRUCTIONS
   - Box plot: proved by `test_boxplot_count_excludes_null_metric_values`. It 
fails on master (counts `{a: 3, b: 2}` instead of `{a: 2, b: 0}`) under both 
pandas 2.3.3 and 3.0.6, and passes with the fix.
   - Pivot CSV totals: proved by 
`test_pivot_df_rows_total_keeps_nan_text_in_non_numeric_metric`. It fails on 
master under pandas 3.0.6 (`nan == 'nan'`) and passes with the fix. 
`tests/unit_tests/charts/` also passes with `-W 
error::pandas.errors.ChainedAssignmentError`.
   - Calendar labels: proved by the new `Calendar value labels leave days 
without data blank` test in `ReactCalendar.test.tsx`. It fails on master 
(`"null"`) and passes with the fix.
   
   ```bash
   pytest tests/unit_tests/pandas_postprocessing/test_boxplot.py 
tests/unit_tests/charts/test_client_processing.py
   cd superset-frontend && npx jest plugins/plugin-chart-calendar
   ```
   
   Manual check: build a calendar heatmap with "Show Values" on over a range 
with gaps. Empty days should carry no label.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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

Reply via email to