File tree 1 file changed +11
-2
lines changed 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -7683,15 +7683,24 @@ def nsmallest(
7683
7683
7684
7684
When using ``keep='all'``, the number of element kept can go beyond ``n``
7685
7685
if there are duplicate values for the largest element, all the
7686
- ties are kept. However, ``nsmallest`` does not keep ``n`` distinct
7687
- smallest elements:
7686
+ ties are kept.
7688
7687
7689
7688
>>> df.nsmallest(3, 'population', keep='all')
7690
7689
population GDP alpha-2
7691
7690
Tuvalu 11300 38 TV
7692
7691
Anguilla 11300 311 AI
7693
7692
Iceland 337000 17036 IS
7694
7693
Nauru 337000 182 NR
7694
+
7695
+ However, ``nsmallest`` does not keep ``n`` distinct
7696
+ smallest elements:
7697
+
7698
+ >>> df.nsmallest(4, 'population', keep='all')
7699
+ population GDP alpha-2
7700
+ Tuvalu 11300 38 TV
7701
+ Anguilla 11300 311 AI
7702
+ Iceland 337000 17036 IS
7703
+ Nauru 337000 182 NR
7695
7704
7696
7705
To order by the smallest values in column "population" and then "GDP", we can
7697
7706
specify multiple columns like in the next example.
You can’t perform that action at this time.
0 commit comments