eland.groupby.DataFrameGroupBy.max#

DataFrameGroupBy.max(numeric_only: bool = True) pd.DataFrame#

计算每个组的最大值。

参数#

numeric_only: {True, False, None} 默认值为 True

要返回的哪种数据类型 - True: 返回所有值为 float64,NaN/NaT 值将被删除 - None: 返回所有值为相同的数据类型(如果可能),NaN/NaT 值将被删除 - False: 返回所有值为相同的数据类型(如果可能),NaN/NaT 值将被保留

返回值#

pandas.DataFrame

每个组的每个数值列的最大值

另请参见#

pandas.core.groupby.GroupBy.max

示例#

>>> df = ed.DataFrame(
...   "http://localhost:9200", "flights",
...   columns=["AvgTicketPrice", "Cancelled", "dayOfWeek", "timestamp", "DestCountry"]
... )
>>> df.groupby("DestCountry").max(numeric_only=False) 
             AvgTicketPrice  Cancelled  dayOfWeek           timestamp
DestCountry
AE              1126.148682       True          6 2018-02-11 04:11:14
AR              1199.642822       True          6 2018-02-11 17:09:05
AT              1181.835815       True          6 2018-02-11 23:12:33
AU              1197.632690       True          6 2018-02-11 21:39:01
CA              1198.852539       True          6 2018-02-11 23:04:08
...                     ...        ...        ...                 ...
RU              1196.742310       True          6 2018-02-11 20:03:31
SE              1198.621582       True          6 2018-02-11 22:06:14
TR               855.935547       True          6 2018-02-04 01:59:23
US              1199.729004       True          6 2018-02-11 23:27:00
ZA              1196.186157       True          6 2018-02-11 23:29:45

[32 rows x 4 columns]