We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I observed a behavior of the Pandas GroupBy method agg() which I cannot explain based on the docs.
agg()
I want to perform a custom aggregation on a grouped DataFrame. Let's take this code snippet:
DataFrame
def aggregate_point(x): print(x) exit() data = data.groupby( pd.Grouper(level='time', freq='1H')).agg(aggregate_point)
This prints a Series for each group.
Series
However, when I pass any additional parameter to aggregate_point, the full DataFrame is being printed:
aggregate_point
def aggregate_point(x, score): print(x) exit() data = data.groupby( pd.Grouper(level='time', freq='1H')).agg(aggregate_point, score=True)
Why does the score parameter influence the value of x (DataFrame vs. Series)?
score
x
The text was updated successfully, but these errors were encountered:
This is a bug, related to #39169. The addition of a parameter should not have this influence.
Sorry, something went wrong.
take
Closing at this appears identical to #39169
jnchngc
No branches or pull requests
Question About GroupBy Aggregation Behavior
I observed a behavior of the Pandas GroupBy method
agg()
which I cannot explain based on the docs.I want to perform a custom aggregation on a grouped
DataFrame
. Let's take this code snippet:This prints a
Series
for each group.However, when I pass any additional parameter to
aggregate_point
, the fullDataFrame
is being printed:Why does the
score
parameter influence the value ofx
(DataFrame
vs.Series
)?The text was updated successfully, but these errors were encountered: