Skip to content

Commit a452c59

Browse files
committed
Minor fix to SPARK-6958: Improve Python docstring for DataFrame.sort.
As a follow up PR to apache#5544. cc davies Author: Reynold Xin <[email protected]> Closes apache#5558 from rxin/sort-doc-improvement and squashes the following commits: f4c276f [Reynold Xin] Review feedback. d2dcf24 [Reynold Xin] Minor fix to SPARK-6958: Improve Python docstring for DataFrame.sort.
1 parent d305e68 commit a452c59

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python/pyspark/sql/dataframe.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,9 @@ def sort(self, *cols, **kwargs):
489489
"""Returns a new :class:`DataFrame` sorted by the specified column(s).
490490
491491
:param cols: list of :class:`Column` or column names to sort by.
492-
:param ascending: sort by ascending order or not, could be bool, int
493-
or list of bool, int (default: True).
492+
:param ascending: boolean or list of boolean (default True).
493+
Sort ascending vs. descending. Specify list for multiple sort orders.
494+
If a list is specified, length of the list must equal length of the `cols`.
494495
495496
>>> df.sort(df.age.desc()).collect()
496497
[Row(age=5, name=u'Bob'), Row(age=2, name=u'Alice')]
@@ -519,7 +520,7 @@ def sort(self, *cols, **kwargs):
519520
jcols = [jc if asc else jc.desc()
520521
for asc, jc in zip(ascending, jcols)]
521522
else:
522-
raise TypeError("ascending can only be bool or list, but got %s" % type(ascending))
523+
raise TypeError("ascending can only be boolean or list, but got %s" % type(ascending))
523524

524525
jdf = self._jdf.sort(self._jseq(jcols))
525526
return DataFrame(jdf, self.sql_ctx)

0 commit comments

Comments
 (0)