This is an automated email from the ASF dual-hosted git repository.

yikun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new dd0bd0762b3 [SPARK-40270][PS][FOLLOWUP] Skip test_style when pandas 
<1.3.0
dd0bd0762b3 is described below

commit dd0bd0762b344ab34e1b08c9bbd2ac77b83856e0
Author: Yikun Jiang <yikunk...@gmail.com>
AuthorDate: Fri Dec 9 22:11:03 2022 +0800

    [SPARK-40270][PS][FOLLOWUP] Skip test_style when pandas <1.3.0
    
    ### What changes were proposed in this pull request?
    According to 
https://pandas.pydata.org/docs/reference/api/pandas.io.formats.style.Styler.to_latex.html:
    `pandas.io.formats.style.Styler.to_latex` introduced since 1.3.0, so before 
panda 1.3.0, should skip the check
    
    ```
    ERROR [0.180s]: test_style 
(pyspark.pandas.tests.test_dataframe.DataFrameTest)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/__w/spark/spark/python/pyspark/pandas/tests/test_dataframe.py", 
line 5795, in test_style
        check_style()
      File "/__w/spark/spark/python/pyspark/pandas/tests/test_dataframe.py", 
line 5793, in check_style
        self.assert_eq(pdf_style.to_latex(), psdf_style.to_latex())
    AttributeError: 'Styler' object has no attribute 'to_latex'
    ```
    
    Related: 
https://github.com/apache/spark/commit/58375a86e6ff49c5bcee49939fbd98eb848ae59f
    
    ### Why are the changes needed?
    This test break the 3.2 branch pyspark test (with python 3.6 + pandas 
1.1.x), so I think better add the `skipIf` it.
    
    See also https://github.com/apache/spark/pull/38982#issuecomment-1343923114
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    - CI passed
    - Test on 3.2 branch: https://github.com/Yikun/spark/pull/194, 
https://github.com/Yikun/spark/actions/runs/3655564439/jobs/6177030747
    
    Closes #39002 from Yikun/skip-check.
    
    Authored-by: Yikun Jiang <yikunk...@gmail.com>
    Signed-off-by: Yikun Jiang <yikunk...@gmail.com>
---
 python/pyspark/pandas/tests/test_dataframe.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/python/pyspark/pandas/tests/test_dataframe.py 
b/python/pyspark/pandas/tests/test_dataframe.py
index 4e80c680b6e..ded110c1231 100644
--- a/python/pyspark/pandas/tests/test_dataframe.py
+++ b/python/pyspark/pandas/tests/test_dataframe.py
@@ -7074,6 +7074,10 @@ class DataFrameTest(ComparisonTestBase, SQLTestUtils):
         psdf = ps.from_pandas(pdf)
         self.assert_eq(pdf.cov(), psdf.cov())
 
+    @unittest.skipIf(
+        LooseVersion(pd.__version__) < LooseVersion("1.3.0"),
+        "pandas support `Styler.to_latex` since 1.3.0",
+    )
     def test_style(self):
         # Currently, the `style` function returns a pandas object `Styler` as 
it is,
         # processing only the number of rows declared in `compute.max_rows`.


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

Reply via email to