funpack.merging
This module contains functions which can merge data from multiple input files.
Merges one or more |
- funpack.merging.mergeDataFrames(data, cols, axis, strategy, dryrun=False)[source]
Merges one or more
pandas.DataFramesaccording to the givenaxisandstrategy.- Parameters:
data – List of
DataFrameobjects to merge.cols – List of lists -
Columnobjects representing the columns in each data set indata.axis – Axis to merge on - either
subjectsorvariables.strategy – Strategy to use for merging
data, eitherunion(an outer join),intersection(inner join), ornaive(naive concatenation alongaxis).dryrun – If
True, onlycolsis merged.
- Returns:
A tuple containing:
a new
DataFramecontaining the mergeddata, orNoneifdryrun is True.A list of
Columnobjects representing the columns that were kept. The index column is at the beginning of the list.
Warning
A dry run may produce different results with the naive merge strategy.