I have a DataFrame which contains 55000 rows and 3 columns I want to return every row as DataFrame from this bigdataframe for using it as parameter of different function. My idea was iterating over big DataFrame by iterrows(),iloc but I can't make it as DataFrame it is showing series type. How could I solve this
Asked
Active
Viewed 87 times
2 Answers
0
I suspect you're doing something not optimal if you need what you describe. That said, if you need each row as a dataframe:
l = [pd.DataFrame(df.iloc[i]) for i in range(len(df))]
This makes a list of dataframes for each row in df

Jim Eisenberg
- 1,490
- 1
- 9
- 17