We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a909e16 commit 6673705Copy full SHA for 6673705
doc/source/basics.rst
@@ -1311,6 +1311,21 @@ Some other sorting notes / nuances:
1311
compatibility with NumPy methods which expect the ``ndarray.sort``
1312
behavior.
1313
1314
+.. versionadded:: 0.14.0
1315
+
1316
+``Series`` has the ``nsmallest`` and ``nlargest`` methods which return the
1317
+smallest or largest :math:`n` values. For a large ``Series`` this can be much
1318
+faster than sorting the entire Series and calling ``head(n)`` on the result.
1319
1320
+.. ipython:: python
1321
1322
+ s = Series(np.random.permutation(10))
1323
+ s
1324
+ s.order()
1325
+ s.nsmallest(3)
1326
+ s.nlargest(3)
1327
1328
1329
Sorting by a multi-index column
1330
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1331
0 commit comments