Github user icexelloss commented on a diff in the pull request:
https://github.com/apache/spark/pull/21471#discussion_r192209406
--- Diff: python/pyspark/sql/functions.py ---
@@ -2548,6 +2549,10 @@ def pandas_udf(f=None, returnType=None,
functionType=None):
| 2|6.0|
+---+---+
+ .. note:: If returning a new `pandas.DataFrame` constructed with a
dictionary, it is
+ recommended to explicitly index the columns by name to ensure the
positions are correct.
+ For example, `pd.DataFrame({'id': ids, 'a': data}, columns=['id',
'a'])`.
--- End diff --
Should we recommend OrderedDict? I feel specifying column names twice is
not ideal
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]