This is my code below. For example, each smaller df contains 3000 rows.
def partition_df(df):
partitioned_df = []
smaller_df = []
for index, row in df.iterrows():
smaller_df.append(row)
if (index % 3000) == 0 and index != 0:
partitioned_df.append(pd.DataFrame(smaller_df))
smaller_df.clear()
if smaller_df:
partitioned_df.append(pd.DataFrame(smaller_df))
return partitioned_df
Is there any issue with this split?