How to use the siuba.experimental.pd_groups.groupby._regroup 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 / dply / vector.py View on Github external
def _row_number_grouped(g: GroupBy) -> GroupBy:
    out = np.ones(len(g.obj), dtype = int)

    indices = g.grouper.indices
    for g_key, inds in indices.items():
        out[inds] = np.arange(1, len(inds) + 1, dtype = int)
    
    return _regroup(out, g)
github machow / siuba / siuba / dply / vector.py View on Github external
def _lag_grouped(x, n = 1, default = None):
    res = x.shift(n, fill_value = default)

    return _regroup(res, x)
github machow / siuba / siuba / experimental / pd_groups / translate.py View on Github external
def f(x, y):
        _validate_data_args(x, y = y)
        left, right, groupby = _maybe_broadcast(x, y)
        
        op_function = getattr(left, name)

        res = op_function(right)
        return _regroup(res, groupby)
github machow / siuba / siuba / dply / vector.py View on Github external
def _lead_grouped(x, n = 1, default = None):
    res = x.shift(-1*n, fill_value = default)

    return _regroup(res, 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 _regroup(res, __ser)
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.obj, name, is_property, accessor, args, kwargs)

        return _regroup(res, __ser)