Skip to content

Commit

Permalink
Make non-experimental and rename toArrowTable
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmcook committed May 7, 2024
1 parent 026374d commit ca0e5f5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion python/pyspark/sql/connect/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@ def _to_table(self) -> Tuple["pa.Table", Optional[StructType]]:
assert table is not None
return (table, schema)

def _toArrow(self) -> "pa.Table":
def toArrowTable(self) -> "pa.Table":
table, _ = self._to_table()
return table

Expand Down
6 changes: 2 additions & 4 deletions python/pyspark/sql/pandas/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def toPandas(self) -> "PandasDataFrameLike":
else:
return pdf

def _toArrow(self) -> "pa.Table":
def toArrowTable(self) -> "pa.Table":
"""
Returns the contents of this :class:`DataFrame` as PyArrow ``pyarrow.Table``.
Expand All @@ -238,15 +238,13 @@ def _toArrow(self) -> "pa.Table":
Examples
--------
>>> df.toArrow() # doctest: +SKIP
>>> df.toArrowTable() # doctest: +SKIP
pyarrow.Table
age: int64
name: string
----
age: [[2,5]]
name: [["Alice","Bob"]]
.. note:: Experimental.
"""
from pyspark.sql.dataframe import DataFrame

Expand Down
2 changes: 1 addition & 1 deletion python/pyspark/sql/tests/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def test_pandas_round_trip(self):
def test_arrow_round_trip(self):
t_in = self.create_arrow_table()
df = self.spark.createDataFrame(self.data, schema=self.schema)
t_out = df._toArrow()
t_out = df.toArrowTable()
self.assertTrue(t_out.equals(t_in))

def test_pandas_self_destruct(self):
Expand Down

0 comments on commit ca0e5f5

Please sign in to comment.