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
Compare the output of these three groupby/apply calls:
In [66]: df = pd.DataFrame({'a': [1, 1, 2, 2], 'b': range(4)}) In [67]: df Out[67]: a b 0 1 0 1 1 1 2 2 2 3 2 3 In [68]: df.groupby('a')['b'].apply(lambda x: 2 * x) Out[68]: 0 0 1 2 2 4 3 6 dtype: int64 In [69]: df.groupby('a').apply(lambda x: 2 * x)['b'] Out[69]: 0 0 1 2 2 4 3 6 Name: b, dtype: int64 In [70]: df.groupby('a').apply(lambda x: 2 * x['b']) Out[70]: a 1 0 0 1 2 2 2 4 3 6 Name: b, dtype: int64
The first two are what I expected; the last is not -- I expected the same result as the previous two.
The text was updated successfully, but these errors were encountered:
warning, this is a rabbit hole.....
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Compare the output of these three groupby/apply calls:
The first two are what I expected; the last is not -- I expected the same result as the previous two.
The text was updated successfully, but these errors were encountered: