piper.verbs.split_dataframe

piper.verbs.split_dataframe(df: pandas.core.frame.DataFrame, chunk_size: int = 1000)List[source]

Split dataframe by chunk_size rows, returning multiple dataframes

  1. Define ‘range’ (start, stop, step/chunksize)

  2. Use np.split() to examine dataframe indices using the calculated ‘range’.

Parameters
  • df – dataframe to be split

  • chunksize – default=1000

Returns

Return type

A list of pd.DataFrame ‘chunks’

Examples

chunks = split(customer_orders_tofix, 1000)
for df in chunks:
    display(head(df, 2))