You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/06/04 17:46:53 UTC
[GitHub] [spark] xinrong-databricks commented on a change in pull request #32592: [SPARK-35343][PYTHON] Make the conversion from/to pandas data-type-based for non-ExtensionDtypes
xinrong-databricks commented on a change in pull request #32592:
URL: https://github.com/apache/spark/pull/32592#discussion_r645748636
##########
File path: python/pyspark/pandas/tests/test_internal.py
##########
@@ -58,6 +58,20 @@ def test_from_pandas(self):
self.assert_eq(internal.to_pandas_frame, pdf1)
+ # categorical column
+ pdf2 = pd.DataFrame({0: [1, 2, 3], 1: pd.Categorical([4, 5, 6])})
+ internal = InternalFrame.from_pandas(pdf2)
+ sdf = internal.spark_frame
+
+ self.assert_eq(internal.index_spark_column_names, [SPARK_DEFAULT_INDEX_NAME])
+ self.assert_eq(internal.index_names, [None])
+ self.assert_eq(internal.column_labels, [(0,), (1,)])
+ self.assert_eq(internal.data_spark_column_names, ["0", "1"])
+ self.assertTrue(internal.spark_column_for((0,))._jc.equals(sdf["0"]._jc))
+ self.assertTrue(internal.spark_column_for((1,))._jc.equals(sdf["1"]._jc))
Review comment:
Glad to know! Thanks.
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org