Suppose I have two DataFrames a & b where a is larger than b and has all NaNs. b.index is a subset of a.index, however b has real values. I wish to merge the values from b into a.
In [102]: mset
Out[102]:
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 9446 entries, 2012-11-02 07:00:00 to 2012-11-05 15:24:00
Data columns:
open 9207 non-null values
high 9207 non-null values
low 9207 non-null values
close 9207 non-null values
dtypes: float64(4)
In [103]: a
Out[103]:
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 1440 entries, 2012-11-14 00:00:00 to 2012-11-14 23:59:00
Freq: T
Data columns:
open 0 non-null values
high 0 non-null values
low 0 non-null values
close 0 non-null values
dtypes: float64(4)
There’s an example of what the dataframes look like.
EDIT:
I’d also like to retain the index as well
Your example dataframes do not match the statement “b.index is a subset of a.index, however b has real values.” The dates are not overlapping. However:
This works for integer indexes, don’t know about ts indexes: