Skip to content

Commit 2e2f3a0

Browse files
committed
add alias methods docs
1 parent af494ff commit 2e2f3a0

File tree

1 file changed

+113
-2
lines changed
  • third_party/bigframes_vendored/pandas/core/groupby

1 file changed

+113
-2
lines changed

third_party/bigframes_vendored/pandas/core/groupby/__init__.py

Lines changed: 113 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,39 @@ def kurt(
426426
"""
427427
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
428428

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+
429462
def sum(
430463
self,
431464
numeric_only: bool = False,
@@ -887,8 +920,6 @@ def rolling(self, *args, **kwargs):
887920
888921
**Examples:**
889922
890-
For SeriesGroupBy:
891-
892923
>>> import bigframes.pandas as bpd
893924
>>> import numpy as np
894925
>>> bpd.options.display.progress_bar = None
@@ -980,6 +1011,38 @@ def agg(self, func):
9801011
"""
9811012
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
9821013

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+
9831046
def nunique(self):
9841047
"""
9851048
Return number of unique elements in the group.
@@ -1052,6 +1115,54 @@ def agg(self, func, **kwargs):
10521115
"""
10531116
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
10541117

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+
10551166
def nunique(self):
10561167
"""
10571168
Return DataFrame with counts of unique elements in each position.

0 commit comments

Comments
 (0)