SeriesGroupBy.
nsmallest
Return the smallest n elements.
Number of items to retrieve.
See also
pyspark.pandas.Series.nsmallest
pyspark.pandas.DataFrame.nsmallest
Examples
>>> df = ps.DataFrame({'a': [1, 1, 1, 2, 2, 2, 3, 3, 3], ... 'b': [1, 2, 2, 2, 3, 3, 3, 4, 4]}, columns=['a', 'b'])
>>> df.groupby(['a'])['b'].nsmallest(1).sort_index() a 1 0 1 2 3 2 3 6 3 Name: b, dtype: int64