groupby.DataFrameGroupBy.min

DataFrameGroupBy.min(numeric_only: bool = True) pd.DataFrame[source]

Compute the min value for each group.

Parameters

numeric_only: {True, False, None} Default is True

Which datatype to be returned - True: Returns all values as float64, NaN/NaT values are removed - None: Returns all values as the same dtype where possible, NaN/NaT are removed - False: Returns all values as the same dtype where possible, NaN/NaT are preserved

Returns

pandas.DataFrame

min value for each numeric column of each group

See Also

:pandas_api_docs:`pandas.core.groupby.GroupBy.min`

Examples

>>> from tests import OPENSEARCH_TEST_CLIENT
>>> df = oml.DataFrame(
...   OPENSEARCH_TEST_CLIENT, "flights",
...   columns=["AvgTicketPrice", "Cancelled", "dayOfWeek", "timestamp", "DestCountry"]
... )
>>> df.groupby("DestCountry").min(numeric_only=False) 
             AvgTicketPrice  Cancelled  dayOfWeek           timestamp
DestCountry
AE               110.799911      False          0 2018-01-01 19:31:30
AR               125.589394      False          0 2018-01-01 01:30:47
AT               100.020531      False          0 2018-01-01 05:24:19
AU               102.294312      False          0 2018-01-01 00:00:00
CA               100.557251      False          0 2018-01-01 00:44:08
...                     ...        ...        ...                 ...
RU               101.004005      False          0 2018-01-01 01:01:51
SE               102.877190      False          0 2018-01-01 04:09:38
TR               142.876465      False          0 2018-01-01 06:45:17
US               100.145966      False          0 2018-01-01 00:06:27
ZA               102.002663      False          0 2018-01-01 06:44:44

[32 rows x 4 columns]