Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def f(x) -> Any:
return GroupByAgg.from_result(x.mean() + 10, x)
def _n_grouped(x: GroupBy) -> GroupByAgg:
return GroupByAgg.from_result(x.size(), x)
def f(__ser, *args, **kwargs):
_validate_data_args(__ser)
res = _apply_grouped_method(__ser, name, is_property, accessor, args, kwargs)
return GroupByAgg.from_result(res, __ser)
def broadcast_group_elements(x, y):
"""Returns 3-tuple of same-length x and y data, plus a reference group by object.
Note:
* Raises error if x and y are not compatible group by objects.
* Will broadcast a GroupByAgg, to ensure same length as other data.
"""
if all_isinstance(GroupByAgg, x, y) and x._orig_grouper is y._orig_grouper:
return x.obj, y.obj, x
elif isinstance(x, GroupByAgg):
return grouper_match(x, y)
elif isinstance(y, GroupByAgg):
res_y, res_x, grp = grouper_match(y, x)
return res_x, res_y, grp
elif all_isinstance(SeriesGroupBy, x, y) and x.grouper is y.grouper:
return x.obj, y.obj, x
raise ValueError("need groupby objects with matching groupers")
def broadcast_group_elements(x, y):
"""Returns 3-tuple of same-length x and y data, plus a reference group by object.
Note:
* Raises error if x and y are not compatible group by objects.
* Will broadcast a GroupByAgg, to ensure same length as other data.
"""
if all_isinstance(GroupByAgg, x, y) and x._orig_grouper is y._orig_grouper:
return x.obj, y.obj, x
elif isinstance(x, GroupByAgg):
return grouper_match(x, y)
elif isinstance(y, GroupByAgg):
res_y, res_x, grp = grouper_match(y, x)
return res_x, res_y, grp
elif all_isinstance(SeriesGroupBy, x, y) and x.grouper is y.grouper:
return x.obj, y.obj, x
raise ValueError("need groupby objects with matching groupers")
def broadcast_group_elements(x, y):
"""Returns 3-tuple of same-length x and y data, plus a reference group by object.
Note:
* Raises error if x and y are not compatible group by objects.
* Will broadcast a GroupByAgg, to ensure same length as other data.
"""
if all_isinstance(GroupByAgg, x, y) and x._orig_grouper is y._orig_grouper:
return x.obj, y.obj, x
elif isinstance(x, GroupByAgg):
return grouper_match(x, y)
elif isinstance(y, GroupByAgg):
res_y, res_x, grp = grouper_match(y, x)
return res_x, res_y, grp
elif all_isinstance(SeriesGroupBy, x, y) and x.grouper is y.grouper:
return x.obj, y.obj, x
raise ValueError("need groupby objects with matching groupers")