Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MINOR] Fixed up pandas_udf related docs and formatting #19375

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/pyspark/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def loads(self, obj):

class ArrowSerializer(FramedSerializer):
"""
Serializes an Arrow stream.
Serializes bytes as Arrow data with the Arrow file format.
"""

def dumps(self, batch):
Expand Down Expand Up @@ -239,7 +239,7 @@ class ArrowStreamPandasSerializer(Serializer):

def dump_stream(self, iterator, stream):
"""
Make ArrowRecordBatches from Pandas Serieses and serialize. Input is a single series or
Make ArrowRecordBatches from Pandas Series and serialize. Input is a single series or
a list of series accompanied by an optional pyarrow type to coerce the data to.
"""
import pyarrow as pa
Expand All @@ -257,7 +257,7 @@ def dump_stream(self, iterator, stream):

def load_stream(self, stream):
"""
Deserialize ArrowRecordBatchs to an Arrow table and return as a list of pandas.Series.
Deserialize ArrowRecordBatches to an Arrow table and return as a list of pandas.Series.
"""
import pyarrow as pa
reader = pa.open_stream(stream)
Expand Down
6 changes: 2 additions & 4 deletions python/pyspark/sql/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2199,16 +2199,14 @@ def pandas_udf(f=None, returnType=StringType()):
...
>>> df = spark.createDataFrame([(1, "John Doe", 21)], ("id", "name", "age"))
>>> df.select(slen("name").alias("slen(name)"), to_upper("name"), add_one("age")) \\
... .show() # doctest: +SKIP
... .show() # doctest: +SKIP
+----------+--------------+------------+
|slen(name)|to_upper(name)|add_one(age)|
+----------+--------------+------------+
| 8| JOHN DOE| 22|
+----------+--------------+------------+
"""
wrapped_udf = _create_udf(f, returnType=returnType, vectorized=True)

return wrapped_udf
return _create_udf(f, returnType=returnType, vectorized=True)


blacklist = ['map', 'since', 'ignore_unicode_prefix']
Expand Down