Jul-19-2019, 01:07 PM
You need to decide where these groups will be stored, in a list, or you want concatenate them into new data-frame?
import pandas as pd # generate sample data df = pd.DataFrame({'factor': pd.np.random.choice(range(5), 1000), 'value':pd.np.random.rand(1000)})\ #groups dfs = [df.loc[v[:50]] for g, v in df.groupby('factor').groups.items()]