ueshin commented on a change in pull request #33506:
URL: https://github.com/apache/spark/pull/33506#discussion_r675920671
##########
File path: python/pyspark/pandas/data_type_ops/categorical_ops.py
##########
@@ -42,6 +42,16 @@ def pretty_name(self) -> str:
def restore(self, col: pd.Series) -> pd.Series:
"""Restore column when to_pandas."""
+ try:
+ pd.Categorical.from_codes(
+ col.replace(np.nan, -1).astype(int),
+ categories=cast(CategoricalDtype, self.dtype).categories,
+ ordered=cast(CategoricalDtype, self.dtype).ordered,
+ )
+ except:
+ print(col)
+ print(self.dtype.categories)
+
Review comment:
seems like a debug print?
--
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]