You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2023/01/19 08:18:01 UTC

[GitHub] [superset] villebro commented on a diff in pull request #22782: chore(lint): fix numpy type errors

villebro commented on code in PR #22782:
URL: https://github.com/apache/superset/pull/22782#discussion_r1080930128


##########
superset/utils/pandas_postprocessing/boxplot.py:
##########
@@ -126,7 +129,7 @@ def outliers(series: Series) -> Set[float]:
     # nanpercentile needs numeric values, otherwise the isnan function
     # that's used in the underlying function will fail
     for column in metrics:
-        if df.dtypes[column] == np.object:
+        if df.dtypes[column] == np.object_:

Review Comment:
   Nowadays `np.object` is the same as `object`:
   ```python
   >>> import numpy as np
   >>> np.object
   <stdin>:1: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. To silence this warning, use `object` by itself. Doing this will not modify any behavior and is safe.
   Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
   <class 'object'>
   ```
   I'm opting for `np.object_` here as it seems cleaner and it also worked (there's a unit test for this, so we'll catch this if it changes in the future). Check https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations 👍 
   ![image](https://user-images.githubusercontent.com/33317356/213389899-09b7951c-4662-4e15-bd7f-344d700d8354.png)
   



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org