Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18378#discussion_r123380675
  
    --- Diff: python/pyspark/sql/tests.py ---
    @@ -2274,6 +2274,21 @@ def count_bucketed_cols(names, 
table="pyspark_bucket"):
                 .mode("overwrite").saveAsTable("pyspark_bucket"))
             self.assertSetEqual(set(data), 
set(self.spark.table("pyspark_bucket").collect()))
     
    +    def test_to_pandas(self):
    +        import numpy as np
    +        schema = StructType().add("a", IntegerType()).add("b", 
StringType())\
    +                             .add("c", BooleanType()).add("d", FloatType())
    +        data = [
    +            (1, "foo", True, 3.0), (2, "foo", True, 5.0),
    +            (3, "bar", False, -1.0), (4, "bar", False, 6.0),
    +        ]
    +        df = self.spark.createDataFrame(data, schema)
    +        types = df.toPandas().dtypes
    --- End diff --
    
    Could we check and skip if `pandas` is not able to import (`numpy` is a 
Pandas dependency. So checking Pandas alone should be fine)?
    
    ```python
    try:
        import pandas
        _have_pandas = True
    except:
        # No Pandas, but that's okay, we'll skip those tests
        pass
    ...
    
        @unittest.skipIf(not _have_pandas, "Pandas not installed")
        def test_to_pandas(self):
            ...
    ```
    
    I at least see the doctest is being skipped, `>>> df.toPandas()  # doctest: 
+SKIP`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to