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.DataFrames
according to the givenaxis
andstrategy
.- Parameters:
data – List of
DataFrame
objects to merge.cols – List of lists -
Column
objects representing the columns in each data set indata
.axis – Axis to merge on - either
subjects
orvariables
.strategy – Strategy to use for merging
data
, eitherunion
(an outer join),intersection
(inner join), ornaive
(naive concatenation alongaxis
).dryrun – If
True
, onlycols
is merged.
- Returns:
A tuple containing:
a new
DataFrame
containing the mergeddata
, orNone
ifdryrun is True
.A list of
Column
objects 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.