Last active
April 18, 2023 15:32
-
-
Save kasperjunge/c751921356a865308eb15966e7b1fd27 to your computer and use it in GitHub Desktop.
Chunk dataframe generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
def chunk_dataframe(df: pd.DataFrame, chunk_size: int) -> pd.DataFrame: | |
for i in range(0, len(df), chunk_size): | |
yield df[i:i+chunk_size] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment