jalpan-randeri opened a new 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 Handle Pandas category type while converting from python with Arrow vector ### Does this PR introduce any user-facing change? No ### How was this patch tested? - Manual Testing ``` Using Python version 2.7.16 (default, Sep 2 2019 11:59:44) SparkSession available as 'spark'. >>> import pandas as pd >>> pdf = pd.DataFrame({"A":[u"a",u"b",u"c",u"a"]}) >>> pdf["B"] = pdf["A"].astype('category') >>> pdf A B 0 a a 1 b b 2 c c 3 a a >>> pdf.dtypes A object B category dtype: object >>> spark.conf.set("spark.sql.execution.arrow.enabled", False) >>> df = spark.createDataFrame(pdf) >>> df.printSchema() root |-- A: string (nullable = true) |-- B: string (nullable = true) >>> df.show() +---+---+ | A| B| +---+---+ | a| a| | b| b| | c| c| | a| a| +---+---+ >>> spark.conf.set("spark.sql.execution.arrow.enabled", True) >>> df = spark.createDataFrame(pdf) >>> df.printSchema() root |-- A: string (nullable = true) |-- B: string (nullable = true) >>> df.show() +---+---+ | A| B| +---+---+ | a| a| | b| b| | c| c| | a| a| +---+---+ >>> ```
---------------------------------------------------------------- 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]
