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 @@ -4131,16 +4131,24 @@ def combine_first(self, other):
4131
4131
----------
4132
4132
other : DataFrame
4133
4133
4134
+ Returns
4135
+ -------
4136
+ combined : DataFrame
4137
+
4134
4138
Examples
4135
4139
--------
4136
- a's values prioritized, use values from b to fill holes:
4137
-
4138
- >>> a.combine_first(b)
4140
+ df1's values prioritized, use values from df2 to fill holes:
4139
4141
4142
+ >>> df1 = pd.DataFrame([[1, np.nan]])
4143
+ >>> df2 = pd.DataFrame([[3, 4]])
4144
+ >>> df1.combine_first(df2)
4145
+ 0 1
4146
+ 0 1 4.0
4140
4147
4141
- Returns
4142
- -------
4143
- combined : DataFrame
4148
+ See Also
4149
+ --------
4150
+ DataFrame.combine : Perform series-wise operation on two DataFrames
4151
+ using a given function
4144
4152
"""
4145
4153
import pandas .core .computation .expressions as expressions
4146
4154
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