Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MicroDataFrame.groupby(col)[[cols]].aggfunc doesn't consider weights #193

Open
MaxGhenis opened this issue Feb 27, 2021 · 1 comment
Open

Comments

@MaxGhenis
Copy link
Collaborator

Example given d = mdf.MicroDataFrame(dict(g=["a", "a", "b"], y=[1, 2, 3]), weights=[4, 5, 6]):

d.groupby("g").sum() works:

y
--

14.0
18.0

d.groupby("g").y.sum() also works:

g
a    14.0
b    18.0
dtype: float64

d.groupby("g").sum()["y"] works too:

g
a    14.0
b    18.0
Name: y, dtype: float64

d.groupby("g")[["y"]].sum() does not:

  | y
-- | --

3
3

d.groupby("g")["y"].sum() also doesn't work:

g
a    3
b    3
Name: y, dtype: int64

d.groupby("g").sum()[["y"]] produces a KeyError (see #192).

@MaxGhenis
Copy link
Collaborator Author

Need to add a __getitem__ to DataFrameGroupBy:

class MicroDataFrameGroupBy(pd.core.groupby.generic.DataFrameGroupBy):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant