pandahandler.frames.joiners

Methods to join/merge/stack multiple data frames.

Functions

safe_hstack(→ pandas.DataFrame)

Horizontally concatenate (i.e. axis=1) data frames after asserting strong assumptions.

Module Contents

pandahandler.frames.joiners.safe_hstack(frames: list[pandas.DataFrame]) pandas.DataFrame[source]

Horizontally concatenate (i.e. axis=1) data frames after asserting strong assumptions.

The naming of this method suggests an apt analogy with numpy’s hstack function, which horizontally stacks arrays. This method is a convenience wrapper around pd.concat that includes the following assertions about the inputs frames:

  • all data frames must share the same index

  • there is no overlap among the columns of the data frames (ignoring the indexes)

Parameters:

frames – The data frames to concatenate.

Raises:
  • ValueError – If no data frames are provided in frames.

  • ValueError – If the data frames do not all share the same index.

  • ValueError – If any column name appears in more than one of the input data frames.