MCPcopy
hub / github.com/pandas-dev/pandas / add

Method add

pandas/core/series.py:7110–7170  ·  view source on GitHub ↗

Return Addition of series and other, element-wise (binary operator `add`). Equivalent to ``series + other``, but with support to substitute a fill_value for missing data in either one of the inputs. Parameters ---------- other : Series or scalar val

(self, other, level=None, fill_value=None, axis: Axis = 0)

Source from the content-addressed store, hash-verified

7108 )
7109
7110 def add(self, other, level=None, fill_value=None, axis: Axis = 0) -> Series:
7111 """
7112 Return Addition of series and other, element-wise (binary operator `add`).
7113
7114 Equivalent to ``series + other``, but with support to substitute a fill_value
7115 for missing data in either one of the inputs.
7116
7117 Parameters
7118 ----------
7119 other : Series or scalar value
7120 With which to compute the addition.
7121 level : int or name
7122 Broadcast across a level, matching Index values on the
7123 passed MultiIndex level.
7124 fill_value : None or float value, default None (NaN)
7125 Fill existing missing (NaN) values, and any new element needed for
7126 successful Series alignment, with this value before computation.
7127 If data in both corresponding Series locations is missing
7128 the result of filling (at that location) will be missing.
7129 axis : {0 or 'index'}
7130 Unused. Parameter needed for compatibility with DataFrame.
7131
7132 Returns
7133 -------
7134 Series
7135 The result of the operation.
7136
7137 See Also
7138 --------
7139 Series.radd : Reverse of the Addition operator, see
7140 `Python documentation
7141 <https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types>`_
7142 for more details.
7143
7144 Examples
7145 --------
7146 >>> a = pd.Series([1, 1, 1, np.nan], index=["a", "b", "c", "d"])
7147 >>> a
7148 a 1.0
7149 b 1.0
7150 c 1.0
7151 d NaN
7152 dtype: float64
7153 >>> b = pd.Series([1, np.nan, 1, np.nan], index=["a", "b", "d", "e"])
7154 >>> b
7155 a 1.0
7156 b NaN
7157 d 1.0
7158 e NaN
7159 dtype: float64
7160 >>> a.add(b, fill_value=0)
7161 a 2.0
7162 b 1.0
7163 c 1.0
7164 d 1.0
7165 e NaN
7166 dtype: float64
7167 """

Callers 15

test_addFunction · 0.95
visit_ClassDefMethod · 0.45
get_defined_errorsFunction · 0.45
get_authorsFunction · 0.45
_get_axes_layoutMethod · 0.45
andrews_curvesFunction · 0.45
parallel_coordinatesFunction · 0.45

Calls 1

_flex_methodMethod · 0.95

Tested by 3

test_addFunction · 0.76