I used a List Comprehension to cut a huge DataFrame into blocks of 100’000:
size = 100000
list_of_dfs = [df.loc[i:i+size-1,:] for i in range(0, len(df),size)]
or as generator:
list_of_dfs = (df.loc[i:i+size-1,:] for i in range(0, len(df),size))
More Related Contents:
- Splitting dataframe into multiple dataframes
- Pandas split DataFrame by column value
- Pandas split column into multiple columns by comma
- Quickest way to make a get_dummies type dataframe from a column with a multiple of strings
- How to deal with SettingWithCopyWarning in Pandas
- 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
- Combine two pandas Data Frames (join on a common column)
- Repeat rows in a pandas DataFrame based on column value
- Accessing every 1st element of Pandas DataFrame column containing lists
- How to deal with multi-level column names downloaded with yfinance
- Replace all occurrences of a string in a pandas dataframe (Python)
- Running get_dummies on several DataFrame columns?
- Python – How to convert JSON File to Dataframe
- How to remove timezone from a Timestamp column in a pandas dataframe
- Pandas lookup from one of multiple columns, based on value
- How to add a suffix (or prefix) to each column name?
- How to delete multiple pandas (python) dataframes from memory to save RAM?
- Subtract two columns in dataframe
- Capitalize first letter of each word in a dataframe column
- Compute the running (cumulative) maximum for a series in pandas
- Get total of Pandas column
- How to read a Parquet file into Pandas DataFrame?
- Get first and second highest values in pandas columns
- Enumerate each row for each group in a DataFrame
- What’s the best way to sum all values in a Pandas dataframe? [duplicate]
- MonthEnd object result in instead of number
- Python Pandas – Combining Multiple Columns into one Staggered Column
- pandas.read_csv FileNotFoundError: File b’\xe2\x80\xaa’ despite correct path