How to use the siuba.experimental.pd_groups.groupby.GroupByAgg function in siuba

To help you get started, we’ve selected a few siuba examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github machow / siuba / siuba / experimental / pd_groups / test_pd_groups.py View on Github external
def f(x) -> Any:
        return GroupByAgg.from_result(x.mean() + 10, x)
github machow / siuba / siuba / dply / vector.py View on Github external
def _n_grouped(x: GroupBy) -> GroupByAgg:
    return GroupByAgg.from_result(x.size(), x)
github machow / siuba / siuba / experimental / pd_groups / translate.py View on Github external
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)
github machow / siuba / siuba / experimental / pd_groups / groupby.py View on Github external
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")
github machow / siuba / siuba / experimental / pd_groups / groupby.py View on Github external
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")
github machow / siuba / siuba / experimental / pd_groups / groupby.py View on Github external
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")