Skip to content

Add groupby example to docs #333

@dougbrn

Description

@dougbrn

Pandas Groupby actually works pretty well out of the box for nested-pandas use cases, things like below work natively because the pandas groupby object actually preserves the nestedframe dtype of the input dataframe when passed along to functions like apply:

from nested_pandas.datasets import generate_data
nf = generate_data(5,10, seed=1)
nf["c"] = [0,0,1,1,1]


def test_func(df):
    return df["nested"].nest.to_flat()
nf_groups = nf.groupby("c").apply(test_func, include_groups=False)

Therefore, rather than a wrapper for this, I think it would be good to add one or two examples to the docs just highlighting that this functionality is available within nested-pandas

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions