bigframes.pandas.api.typing.SeriesGroupBy.first#

SeriesGroupBy.first(numeric_only: bool = False, min_count: int = -1) Series[source]#

Compute the first entry of each column within each group.

Defaults to skipping NA elements.

Examples:

>>> import bigframes.pandas as bpd
>>> df = bpd.DataFrame(dict(A=[1, 1, 3], B=[None, 5, 6], C=[1, 2, 3]))
>>> df.groupby("A").first()
    B  C
A
1  5.0  1
3  6.0  3

[2 rows x 2 columns]
>>> df.groupby("A").first(min_count=2)
    B    C
A
1  <NA>     1
3  <NA>  <NA>

[2 rows x 2 columns]
Parameters:
  • numeric_only (bool, default False) – Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data.

  • min_count (int, default -1) – The required number of valid values to perform the operation. If fewer than min_count valid values are present the result will be NA.

Returns:

First of values within each group.

Return type:

bigframes.pandas.DataFrame or bigframes.pandas.Series