fixed the issue. Will look into that further I am reading data from an excel file: the dataframe resulting is an array with a single column and several lines: , You can try the following.
df['group'] = df.index//5 # add extra column to hold the group value
new_df = df.groupby('group').identifier.apply(list).apply(pd.Series)
df.drop('group', axis=1) # drop the extra column that was created.