File tree 2 files changed +29
-7
lines changed
2 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -4125,16 +4125,24 @@ def combine_first(self, other):
4125
4125
----------
4126
4126
other : DataFrame
4127
4127
4128
+ Returns
4129
+ -------
4130
+ combined : DataFrame
4131
+
4128
4132
Examples
4129
4133
--------
4130
- a's values prioritized, use values from b to fill holes:
4131
-
4132
- >>> a.combine_first(b)
4134
+ df1's values prioritized, use values from df2 to fill holes:
4133
4135
4136
+ >>> df1 = pd.DataFrame([[1, np.nan]])
4137
+ >>> df2 = pd.DataFrame([[3, 4]])
4138
+ >>> df1.combine_first(df2)
4139
+ 0 1
4140
+ 0 1 4.0
4134
4141
4135
- Returns
4136
- -------
4137
- combined : DataFrame
4142
+ See Also
4143
+ --------
4144
+ DataFrame.combine : Perform series-wise operation on two DataFrames
4145
+ using a given function
4138
4146
"""
4139
4147
import pandas .core .computation .expressions as expressions
4140
4148
Original file line number Diff line number Diff line change @@ -1764,7 +1764,21 @@ def combine_first(self, other):
1764
1764
1765
1765
Returns
1766
1766
-------
1767
- y : Series
1767
+ combined : Series
1768
+
1769
+ Examples
1770
+ --------
1771
+ >>> s1 = pd.Series([1, np.nan])
1772
+ >>> s2 = pd.Series([3, 4])
1773
+ >>> s1.combine_first(s2)
1774
+ 0 1.0
1775
+ 1 4.0
1776
+ dtype: float64
1777
+
1778
+ See Also
1779
+ --------
1780
+ Series.combine : Perform elementwise operation on two Series
1781
+ using a given function
1768
1782
"""
1769
1783
new_index = self .index .union (other .index )
1770
1784
this = self .reindex (new_index , copy = False )
You can’t perform that action at this time.
0 commit comments