@@ -426,6 +426,39 @@ def kurt(
426
426
"""
427
427
raise NotImplementedError (constants .ABSTRACT_METHOD_ERROR_MESSAGE )
428
428
429
+ def kurtosis (
430
+ self ,
431
+ * ,
432
+ numeric_only : bool = False ,
433
+ ):
434
+ """
435
+ Return unbiased kurtosis over requested axis.
436
+
437
+ Kurtosis obtained using Fisher's definition of
438
+ kurtosis (kurtosis of normal == 0.0). Normalized by N-1.
439
+
440
+ **Examples:**
441
+
442
+ >>> import bigframes.pandas as bpd
443
+ >>> bpd.options.display.progress_bar = None
444
+
445
+ >>> lst = ['a', 'a', 'a', 'a', 'b', 'b', 'b', 'b', 'b']
446
+ >>> ser = bpd.Series([0, 1, 1, 0, 0, 1, 2, 4, 5], index=lst)
447
+ >>> ser.groupby(level=0).kurtosis()
448
+ a -6.0
449
+ b -1.963223
450
+ dtype: Float64
451
+
452
+ Args:
453
+ numeric_only (bool, default False):
454
+ Include only `float`, `int` or `boolean` data.
455
+
456
+ Returns:
457
+ Series or DataFrame
458
+ Variance of values within each group.
459
+ """
460
+ raise NotImplementedError (constants .ABSTRACT_METHOD_ERROR_MESSAGE )
461
+
429
462
def sum (
430
463
self ,
431
464
numeric_only : bool = False ,
@@ -887,8 +920,6 @@ def rolling(self, *args, **kwargs):
887
920
888
921
**Examples:**
889
922
890
- For SeriesGroupBy:
891
-
892
923
>>> import bigframes.pandas as bpd
893
924
>>> import numpy as np
894
925
>>> bpd.options.display.progress_bar = None
@@ -980,6 +1011,38 @@ def agg(self, func):
980
1011
"""
981
1012
raise NotImplementedError (constants .ABSTRACT_METHOD_ERROR_MESSAGE )
982
1013
1014
+ def aggregate (self , func ):
1015
+ """
1016
+ Aggregate using one or more operations.
1017
+
1018
+ **Examples:**
1019
+
1020
+ >>> import bigframes.pandas as bpd
1021
+ >>> import numpy as np
1022
+ >>> bpd.options.display.progress_bar = None
1023
+
1024
+ >>> s = bpd.Series([1, 2, 3, 4], index=[1, 1, 2, 2])
1025
+ >>> s.groupby(level=0).aggregate(['min', 'max'])
1026
+ min max
1027
+ 1 1 2
1028
+ 2 3 4
1029
+ <BLANKLINE>
1030
+ [2 rows x 2 columns]
1031
+
1032
+ Args:
1033
+ func : function, str, list, dict or None
1034
+ Function to use for aggregating the data.
1035
+
1036
+ Accepted combinations are:
1037
+
1038
+ - string function name
1039
+ - list of function names, e.g. ``['sum', 'mean']``
1040
+
1041
+ Returns:
1042
+ Series or DataFrame
1043
+ """
1044
+ raise NotImplementedError (constants .ABSTRACT_METHOD_ERROR_MESSAGE )
1045
+
983
1046
def nunique (self ):
984
1047
"""
985
1048
Return number of unique elements in the group.
@@ -1052,6 +1115,54 @@ def agg(self, func, **kwargs):
1052
1115
"""
1053
1116
raise NotImplementedError (constants .ABSTRACT_METHOD_ERROR_MESSAGE )
1054
1117
1118
+ def aggregate (self , func , ** kwargs ):
1119
+ """
1120
+ Aggregate using one or more operations.
1121
+
1122
+ **Examples:**
1123
+
1124
+ >>> import bigframes.pandas as bpd
1125
+ >>> import numpy as np
1126
+ >>> bpd.options.display.progress_bar = None
1127
+
1128
+ >>> data = {"A": [1, 1, 2, 2],
1129
+ ... "B": [1, 2, 3, 4],
1130
+ ... "C": [0.362838, 0.227877, 1.267767, -0.562860]}
1131
+ >>> df = bpd.DataFrame(data)
1132
+
1133
+ The aggregation is for each column.
1134
+
1135
+ >>> df.groupby('A').aggregate('min')
1136
+ B C
1137
+ A
1138
+ 1 1 0.227877
1139
+ 2 3 -0.56286
1140
+ <BLANKLINE>
1141
+ [2 rows x 2 columns]
1142
+
1143
+ Args:
1144
+ func (function, str, list, dict or None):
1145
+ Function to use for aggregating the data.
1146
+
1147
+ Accepted combinations are:
1148
+
1149
+ - string function name
1150
+ - list of function names, e.g. ``['sum', 'mean']``
1151
+ - dict of axis labels -> function names or list of such.
1152
+ - None, in which case ``**kwargs`` are used with Named Aggregation. Here the
1153
+ output has one column for each element in ``**kwargs``. The name of the
1154
+ column is keyword, whereas the value determines the aggregation used to compute
1155
+ the values in the column.
1156
+
1157
+ kwargs
1158
+ If ``func`` is None, ``**kwargs`` are used to define the output names and
1159
+ aggregations via Named Aggregation. See ``func`` entry.
1160
+
1161
+ Returns:
1162
+ DataFrame
1163
+ """
1164
+ raise NotImplementedError (constants .ABSTRACT_METHOD_ERROR_MESSAGE )
1165
+
1055
1166
def nunique (self ):
1056
1167
"""
1057
1168
Return DataFrame with counts of unique elements in each position.
0 commit comments