I have a df that is 10800535 rows and 60 columns
.
I want to split this dataframe by index so that first dataframe has top 5400267 rows and the second one has the bottom 5400268.
both dataframes should have the same columns.
I have a df that is 10800535 rows and 60 columns
.
I want to split this dataframe by index so that first dataframe has top 5400267 rows and the second one has the bottom 5400268.
both dataframes should have the same columns.
Use loc
with index
as:
df1 = df.loc[:5400268,:] # 0 to 5400267 rows and all 60 columns
df2 = df.loc[5400268:,:] # 5400268 to last rows and all 60 columns