@@ -2992,34 +2992,46 @@ def combine(self, other, func, fill_value=None) -> Series:
29922992
29932993 def combine_first (self , other ) -> Series :
29942994 """
2995- Combine Series values, choosing the calling Series's values first.
2995+ Update null elements with value in the same location in 'other'.
2996+
2997+ Combine two Series objects by filling null values in one Series with
2998+ non-null values from the other Series. Result index will be the union
2999+ of the two indexes.
29963000
29973001 Parameters
29983002 ----------
29993003 other : Series
3000- The value(s) to be combined with the `Series` .
3004+ The value(s) to be used for filling null values .
30013005
30023006 Returns
30033007 -------
30043008 Series
3005- The result of combining the Series with the other object.
3009+ The result of combining the provided Series with the other object.
30063010
30073011 See Also
30083012 --------
3009- Series.combine : Perform elementwise operation on two Series
3013+ Series.combine : Perform element-wise operation on two Series
30103014 using a given function.
30113015
3012- Notes
3013- -----
3014- Result index will be the union of the two indexes.
3015-
30163016 Examples
30173017 --------
30183018 >>> s1 = pd.Series([1, np.nan])
3019- >>> s2 = pd.Series([3, 4])
3019+ >>> s2 = pd.Series([3, 4, 5 ])
30203020 >>> s1.combine_first(s2)
30213021 0 1.0
30223022 1 4.0
3023+ 2 5.0
3024+ dtype: float64
3025+
3026+ Null values still persist if the location of that null value
3027+ does not exist in `other`
3028+
3029+ >>> s1 = pd.Series({'falcon': np.nan, 'eagle': 160.0})
3030+ >>> s2 = pd.Series({'eagle': 200.0, 'duck': 30.0})
3031+ >>> s1.combine_first(s2)
3032+ duck 30.0
3033+ eagle 160.0
3034+ falcon NaN
30233035 dtype: float64
30243036 """
30253037 new_index = self .index .union (other .index )
0 commit comments