You can take the floor division of a sequence up to the amount of rows in the dataframe, and use it to groupby
splitting the dataframe into equally sized chunks:
n = 400
for g, df in test.groupby(np.arange(len(test)) // n):
print(df.shape)
# (400, 2)
# (400, 2)
# (311, 2)
More Related Contents:
- Pandas percentage of total with groupby
- Scatter plots in Pandas/Pyplot: How to plot by category [duplicate]
- Using Pandas to pd.read_excel() for multiple worksheets of the same workbook
- How to add pandas data to an existing csv file?
- How to explode a list inside a Dataframe cell into separate rows
- How do I operate on a DataFrame with a Series for every column?
- Pandas split column into multiple columns by comma
- Repeat rows in a pandas DataFrame based on column value
- Accessing every 1st element of Pandas DataFrame column containing lists
- Dropping infinite values from dataframes in pandas?
- How to use groupby to concatenate strings in python pandas?
- Horizontal stacked bar plot and add labels to each section
- How to flatten a nested JSON recursively, with flatten_json
- How to invoke pandas.rolling.apply with parameters from multiple column?
- Convert commas decimal separators to dots within a Dataframe
- How to remove timezone from a Timestamp column in a pandas dataframe
- Pandas lookup from one of multiple columns, based on value
- ‘utf-8’ codec can’t decode byte 0x92 in position 18: invalid start byte
- Pandas – Compute z-score for all columns
- How can I use cumsum within a group in Pandas?
- Why does df.apply(tuple) work but not df.apply(list)?
- Plot multiple columns of pandas DataFrame on the bar chart
- How to get unique values from multiple columns in a pandas groupby
- Merge a list of pandas dataframes
- How do I delete a column that contains only zeros in Pandas?
- How to repeat a Pandas DataFrame?
- Pandas ParserError EOF character when reading multiple csv files to HDF5
- Get column name where value is something in pandas dataframe
- How to compute jaccard similarity from a pandas dataframe
- How to convert DataFrame.append() to pandas.concat()?