Pandas Split DataFrame using row index
1
I want to split dataframe by uneven number of rows using row index. The below code: groups = df.groupby((np.arange(len(df.index))/l[1]).astype(int)) works only for uniform number of rows. df a b c 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 l = [2, 5, 7] df1 1 1 1 2 2 2 df2 3,3,3 4,4,4 5,5,5 df3 6,6,6 7,7,7 df4 8,8,8
python pandas dataframe pandas-groupby
share | improve this question
edited Nov 20 '18 at 11:04
anky_91
1,055 2 14
asked Nov 20 '18 at 10:51
...