codeant-ai-for-open-source[bot] commented on code in PR #36605:
URL: https://github.com/apache/superset/pull/36605#discussion_r2617973329


##########
superset/utils/pandas_postprocessing/boxplot.py:
##########
@@ -127,6 +127,6 @@ def outliers(series: Series) -> set[float]:
     # that's used in the underlying function will fail
     for column in metrics:
         if df.dtypes[column] == np.object_:

Review Comment:
   **Suggestion:** The dtype check `df.dtypes[column] == np.object_` is brittle 
and relies on the deprecated `np.object_` sentinel; it can mis-detect 
object-like columns on newer pandas/numpy versions. Use 
`pandas.api.types.is_object_dtype` to robustly detect object dtypes before 
coercion. [type error]
   
   **Severity Level:** Minor ⚠️
   ```suggestion
       from pandas.api.types import is_object_dtype
       for column in metrics:
           if is_object_dtype(df[column].dtype):
   ```
   <details>
   <summary><b>Why it matters? ⭐ </b></summary>
   
   The current comparison to np.object_ is brittle and may trigger deprecation 
warnings or mis-detections on newer numpy/pandas versions.
   Replacing it with pandas.api.types.is_object_dtype (or similar dtype checks) 
is a correct, minimal, and safe improvement that addresses a real 
robustness/deprecation issue.
   </details>
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset/utils/pandas_postprocessing/boxplot.py
   **Line:** 128:129
   **Comment:**
        *Type Error: The dtype check `df.dtypes[column] == np.object_` is 
brittle and relies on the deprecated `np.object_` sentinel; it can mis-detect 
object-like columns on newer pandas/numpy versions. Use 
`pandas.api.types.is_object_dtype` to robustly detect object dtypes before 
coercion.
   
   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.
   ```
   </details>



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