abraxos.utils.split

abraxos.utils.split(df, i=2)[source]

Splits a DataFrame into i approximately equal parts.

Parameters:
  • df (pd.DataFrame) – The DataFrame to be split.

  • i (int, optional) – The number of parts to split the DataFrame into (default is 2).

Returns:

A tuple containing i DataFrames, each being a partition of the original DataFrame.

Return type:

tuple of pd.DataFrame

Examples

>>> import pandas as pd
>>> import abraxos
>>> df = pd.DataFrame({'A': range(10)})
>>> abraxos.split(df, 3)
(   A
0  0
1  1
2  2
3  3,
   A
4  4
5  5
6  6,
   A
7  7
8  8
9  9)