Skip to content

Relational data

class RelationalData

RelationalData.__init__

def __init__(data: Data, schema: Schema) -> None

Relational data structure.

Arguments:

  • data - A dictionary with table names as keys and pandas.DataFrame’s as values.
  • schema - A Schema object.

RelationalData.split

def split(ratio: float | int | dict[str, float | int],
reset_index: bool = False,
rng: NpRng = None) -> tuple[RD, RD]

Split the input data according to the given ratios for each root table.

Arguments:

  • ratio - Split ratio. If a float, it must be between 0 and 1. If an integer > 1, then it is interpreted as the number of rows. If a dictionary, it must contain a split ratio for each root table (except LUTs).
  • reset_index - Whether to reset the index of the resulting dataframes.
  • rng - Random state. If an int, it will be used as seed, if None the seed will be chosen randomly.

Returns:

Tuple with the two splits.