Skip to content Skip to sidebar Skip to footer

Converting Pandas.core.groupby.seriesgroupby To Dataframe

I had a dataframe and I applied the groupby method. Now I have a pandas.core.groupby.SeriesGroupBy but I cant use any of the dataframe methods onto it. How can I convert it to a us

Solution 1:

You can convert the pandas.core.groupby.SeriesGroupBy to a DataFrame very simply as follows:

survivor.apply(pd.DataFrame)

Solution 2:

It seeem you need apply custom function:

def func(x):
    #your code
    return x


survivor.apply(func)

Post a Comment for "Converting Pandas.core.groupby.seriesgroupby To Dataframe"