Dividing pandas dataframe to to separate dataframes by rows

I have a dataframe, for example:

a b c
0 1 2
3 4 5
6 7 8

and i need to separate it by rows and create a new dataframe from each row. i tried to iterate over the rows and then for each row (which is a seriese) i tried the command row.to_df() but it gives me a weird result.

basicly im looking to create bew dataframe sa such:

a b c
0 1 2


a b c
3 4 5


a b c
7 8 9

Answer

You can try doing:

for _, row in df.iterrows():
   new_df = pd.DataFrame(row).T.reset_index(drop=True)

This will create a new DataFrame object from each row (Series Object) in the original DataFrame df.