ChunkDf#

class pandas_utils.df_handling.ChunkDf(df, chunk_size)#

Bases: object

Generator to split a dataframe into chunks.

Similar to chunk_df(), but validates the input arguments and throws and error if not valid.

Parameters:
  • df (DataFrame) – the pandas.DataFrame to chunk.

  • chunk_size (int) – The size of the chunks to use, in terms of rows.

Raises:
  • ValueError: – If chunk_size is less than or equal to 0. Or if it is not and integer value.

  • TypeError: – If chunk_size is not and integer

See also

caf.toolkit.pandas_utils.chunk_df()