HyukjinKwon commented on a change in pull request #26585:
[WIP][SPARK-25351][SQL][Python] Handle Pandas category type when converting
from Python with Arrow
URL: https://github.com/apache/spark/pull/26585#discussion_r347675326
##########
File path: python/pyspark/serializers.py
##########
@@ -298,7 +298,10 @@ def create_array(s, t):
if t is not None and pa.types.is_timestamp(t):
s = _check_series_convert_timestamps_internal(s,
self._timezone)
try:
- array = pa.Array.from_pandas(s, mask=mask, type=t,
safe=self._safecheck)
+ if str(s.dtype) == 'category':
+ array = pa.array(s.get_values())
Review comment:
Can we have a way to convert from/to PySpark and Pandas in roundtrip?
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]