Is there a way to reshape DataFrame to another with unrestricted rows. I just want a DataFrame with 3 columns, no matter how many rows is going to be in DataFrame?
df = (pd.DataFrame(letters.groupby(letters.index // 3)['Letters']
.apply(list)
.values
.tolist(), columns=['first','second','third']).fillna(0))
print (df)
first second third
0 A B C
1 D E F
2 G H I
3 J 0 0