I have a pandas dataframe on which I call df.groupby('foo').apply(bar) where bar is a function that return a dataframe. I want the result to be a series with index of the different values of foo and elements being the different dataframes returned by bar (the inuitvie result as this is how groupby().apply() behaves with all other return types of bar ). However instead I get a multi index dataframe with the first index being the different values of foo and the second index being the index of the dataframes that are returned by bar . How can I convert it to the desired format? source https://stackoverflow.com/questions/76614666/get-pandas-groupby-apply-result-as-a-series-of-dataframes
A site where you can share knowledge