codeant-ai-for-open-source[bot] commented on code in PR #43693:
URL: https://github.com/apache/superset/pull/43693#discussion_r3889834027
##########
superset/utils/pandas_postprocessing/pivot.py:
##########
@@ -301,6 +301,12 @@ def pivot( # pylint: disable=too-many-arguments # noqa:
C901
if columns and column_fill_value:
df[columns] = df[columns].fillna(value=column_fill_value)
+ # Fill NULL/NaN values in the index columns with NULL_STRING so that
+ # NULL grouping keys survive as a real "<NULL>" row in the pivot output.
+ # Mirrors the column fill above; pivot_table() drops NaN index rows
+ # regardless of the dropna= setting (dropna only governs the column axis).
+ df[index] = df[index].fillna(value=NULL_STRING)
Review Comment:
**Suggestion:** Filling a categorical index with a new `NULL_STRING`
category raises `TypeError`, so pivots fail whenever a categorical index
contains missing values. [type error]
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=70dc9e7986e74069a4c956f24867a3c8&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=70dc9e7986e74069a4c956f24867a3c8&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/utils/pandas_postprocessing/pivot.py
**Line:** 308:308
**Comment:**
*Type Error: Filling a categorical index with a new `NULL_STRING`
category raises `TypeError`, so pivots fail whenever a categorical index
contains missing values.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43693&comment_hash=c18e4b0c82904c7ce3db7a088525886fab34a9330d79bf66923e8515e23257c6&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43693&comment_hash=c18e4b0c82904c7ce3db7a088525886fab34a9330d79bf66923e8515e23257c6&reaction=dislike'>๐</a>
--
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]