pyspark.pandas.groupby.GroupBy.idxmin¶
-
GroupBy.
idxmin
(skipna: bool = True) → FrameLike¶ Return index of first occurrence of minimum over requested axis in group. NA/null values are excluded.
- Parameters
- skipnaboolean, default True
Exclude NA/null values. If an entire row/column is NA, the result will be NA.
See also
Series.idxmin
DataFrame.idxmin
pyspark.pandas.Series.groupby
pyspark.pandas.DataFrame.groupby
Examples
>>> df = ps.DataFrame({'a': [1, 1, 2, 2, 3], ... 'b': [1, 2, 3, 4, 5], ... 'c': [5, 4, 3, 2, 1]}, columns=['a', 'b', 'c'])
>>> df.groupby(['a'])['b'].idxmin().sort_index() a 1 0 2 2 3 4 Name: b, dtype: int64
>>> df.groupby(['a']).idxmin().sort_index() b c a 1 0 1 2 2 3 3 4 4