We can use numpy to split a dataframe into N equal parts as follows:
import pandas as pd import numpy as np df=pd.DataFrame({'A':[1,2,3,4,5,6,7,8,9]}) df
Now let’s split the Dataframe into 3 equal parts.
df_split = np.array_split(df, 3)
Now you can treat the df_split as a list of dataframes.
df_split[0]
df_split[1]
df_split[2]