HyukjinKwon opened a new pull request #30114:
URL: https://github.com/apache/spark/pull/30114


   ### What changes were proposed in this pull request?
   
   This PR is a small followup of https://github.com/apache/spark/pull/28793 
and  proposes to use `is_categorical_dtype` instead of deprecated 
`is_categorical`.
   
   `is_categorical_dtype` exists from minimum pandas version we support 
(https://github.com/pandas-dev/pandas/blob/v0.23.2/pandas/core/dtypes/api.py), 
and `is_categorical` was deprecated from pandas 1.1.0 
(https://github.com/pandas-dev/pandas/commit/87a1cc21cab751c16fda4e6f0a95988a8d90462b).
   
   ### Why are the changes needed?
   
   To avoid using deprecated APIs, and remove warnings.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, it will remove warnings that says `is_categorical` is deprecated.
   
   ### How was this patch tested?
   
   By running any pandas UDF with pandas 1.1.0+: 
   
   ```python
   import pandas as pd
   from pyspark.sql.functions import pandas_udf
   
   def func(x: pd.Series) -> pd.Series:
       return x
   
   spark.range(10).select(pandas_udf(func, "long")("id")).show()
   ```
   
   Before:
   
   ```
   /.../python/lib/pyspark.zip/pyspark/sql/pandas/serializers.py:151: 
FutureWarning: is_categorical is deprecated and will be removed in a future 
version.  Use is_categorical_dtype instead
   ...
   ```
   
   After:
   
   ```
   ...
   ```


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

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