DataFrame.combine(other, func, fill_value=None, overwrite=True) [source]
Add two DataFrame objects and do not propagate NaN values, so if for a (column, time) one frame is missing a value, it will default to the other frame’s value (which might be NaN as well)
| Parameters: |
func : function Function that takes two series as inputs and return a Series or a scalar
overwrite : boolean, default True If True then overwrite values for common keys in the calling frame |
|---|---|
| Returns: |
|
See also
DataFrame.combine_first
>>> df1 = DataFrame({'A': [0, 0], 'B': [4, 4]})
>>> df2 = DataFrame({'A': [1, 1], 'B': [3, 3]})
>>> df1.combine(df2, lambda s1, s2: s1 if s1.sum() < s2.sum() else s2)
A B
0 0 3
1 0 3
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
http://pandas.pydata.org/pandas-docs/version/0.23.4/generated/pandas.DataFrame.combine.html