You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When applying different functions to columns with a MultiIndex by supplying a mapping to groupby.agg(), the top-level name of the columns get lost.
I believe this is a bug, because the names of the columns are unchanged (the total number of columns might be smaller, if not all columns are in the mapping, though).
In the example here I am using groupby.agg(), even though technically speaking I want to do a transformation. However, groupby.agg() seems to be the only apply-like method that allows the usage of a mapping for different functions per column. What would be the recommended way?
others have thoughts on this? I guess if you're using agg, it ought to maintain the metadata, given that you have to specify columns that already exist. Not sure about other cases.
This is a nonsencial example, as it produces a Dataframe where each element is a DataFrame itself. This is not valid as a real grouping. Yes it works, but it is impossible to infer anything from this. If you have a simpler example that you can provide that shows the missing columns, pls show it.
I wouldn't actually do it this way, rather simply get the grouper, iterate it yourself, apply whatever transformation you want and then do what you want with the results.
When applying different functions to columns with a MultiIndex by supplying a mapping to groupby.agg(), the top-level name of the columns get lost.
I believe this is a bug, because the names of the columns are unchanged (the total number of columns might be smaller, if not all columns are in the mapping, though).
In the example here I am using groupby.agg(), even though technically speaking I want to do a transformation. However, groupby.agg() seems to be the only apply-like method that allows the usage of a mapping for different functions per column. What would be the recommended way?
The text was updated successfully, but these errors were encountered: