Skip to content

Commit

Permalink
[SPARK-45177][PS] Remove col_space parameter from to_latex
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?

This PR proposes to remove `col_space` parameter from `DataFrame.to_latex` and `Series.to_latex`

### Why are the changes needed?

Since they're also removed from Pandas 2.0.0, so we should follow.

### Does this PR introduce _any_ user-facing change?

`col_space` from `DataFrame.to_latex` and `Series.to_latex` has been removed as mentioned from migration guide.

### How was this patch tested?

Removed the deprecated tests.

### Was this patch authored or co-authored using generative AI tooling?

No

Closes apache#42937 from itholic/SPARK-45177.

Authored-by: Haejoon Lee <haejoon.lee@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
  • Loading branch information
itholic authored and HyukjinKwon committed Sep 15, 2023
1 parent 74d3d87 commit 213ac1c
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 19 deletions.
1 change: 1 addition & 0 deletions python/docs/source/migration_guide/pyspark_upgrade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Upgrading from PySpark 3.5 to 4.0
* In Spark 4.0, ``squeeze`` parameter from ``ps.read_csv`` and ``ps.read_excel`` has been removed from pandas API on Spark.
* In Spark 4.0, ``null_counts`` parameter from ``DataFrame.info`` has been removed from pandas API on Spark, use ``show_counts`` instead.
* In Spark 4.0, the result of ``MultiIndex.append`` does not keep the index names from pandas API on Spark.
* In Spark 4.0, ``col_space`` parameter from ``DataFrame.to_latex`` and ``Series.to_latex`` has been removed from pandas API on Spark.


Upgrading from PySpark 3.3 to 3.4
Expand Down
11 changes: 0 additions & 11 deletions python/pyspark/pandas/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2473,7 +2473,6 @@ def to_latex(
self,
buf: Optional[IO[str]] = None,
columns: Optional[List[Name]] = None,
col_space: Optional[int] = None,
header: bool = True,
index: bool = True,
na_rep: str = "NaN",
Expand Down Expand Up @@ -2509,11 +2508,6 @@ def to_latex(
Buffer to write to. If None, the output is returned as a string.
columns : list of label, optional
The subset of columns to write. Writes all columns by default.
col_space : int, optional
The minimum width of each column.
.. deprecated:: 3.4.0
header : bool or list of str, default True
Write out the column names. If a list of strings is given, it is assumed to be aliases
for the column names.
Expand Down Expand Up @@ -2590,11 +2584,6 @@ def to_latex(
\bottomrule
\end{tabular}
"""
warnings.warn(
"Argument `col_space` will be removed in 4.0.0.",
FutureWarning,
)

args = locals()
psdf = self
return validate_arguments_and_invoke_function(
Expand Down
6 changes: 0 additions & 6 deletions python/pyspark/pandas/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,6 @@ def to_latex(
self,
buf: Optional[IO[str]] = None,
columns: Optional[List[Name]] = None,
col_space: Optional[int] = None,
header: bool = True,
index: bool = True,
na_rep: str = "NaN",
Expand All @@ -1682,11 +1681,6 @@ def to_latex(
multicolumn_format: Optional[str] = None,
multirow: Optional[bool] = None,
) -> Optional[str]:
warnings.warn(
"Argument `col_space` will be removed in 4.0.0.",
FutureWarning,
)

args = locals()
psseries = self
return validate_arguments_and_invoke_function(
Expand Down
1 change: 0 additions & 1 deletion python/pyspark/pandas/tests/test_dataframe_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ def test_to_latex(self):
psdf = self.psdf

self.assert_eq(psdf.to_latex(), pdf.to_latex())
self.assert_eq(psdf.to_latex(col_space=2), pdf.to_latex(col_space=2))
self.assert_eq(psdf.to_latex(header=True), pdf.to_latex(header=True))
self.assert_eq(psdf.to_latex(index=False), pdf.to_latex(index=False))
self.assert_eq(psdf.to_latex(na_rep="-"), pdf.to_latex(na_rep="-"))
Expand Down
1 change: 0 additions & 1 deletion python/pyspark/pandas/tests/test_series_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def test_to_latex(self):
psser = self.psser

self.assert_eq(psser.to_latex(), pser.to_latex())
self.assert_eq(psser.to_latex(col_space=2), pser.to_latex(col_space=2))
self.assert_eq(psser.to_latex(header=True), pser.to_latex(header=True))
self.assert_eq(psser.to_latex(index=False), pser.to_latex(index=False))
self.assert_eq(psser.to_latex(na_rep="-"), pser.to_latex(na_rep="-"))
Expand Down

0 comments on commit 213ac1c

Please sign in to comment.