MCPcopy Create free account
hub / github.com/javascriptdata/danfojs / add

Method add

src/danfojs-base/core/series.ts:259–271  ·  view source on GitHub ↗
(other: Series | Array<number> | number, options?: { inplace?: boolean })

Source from the content-addressed store, hash-verified

257 */
258 add(other: Series | Array<number> | number, options?: { inplace?: boolean }): Series
259 add(other: Series | Array<number> | number, options?: { inplace?: boolean }): Series | void {
260 const { inplace } = { inplace: false, ...options }
261
262 if (this.dtypes[0] == "string") ErrorThrower.throwStringDtypeOperationError("add")
263
264 const newData = _genericMathOp({ ndFrame: this, other, operation: "add" })
265
266 if (inplace) {
267 this.$setValues(newData as ArrayType1D)
268 } else {
269 return utils.createNdframeFromNewDataWithOldProps({ ndFrame: this, newData, isSeries: true }) as Series
270 }
271 }
272
273 /**
274 * Returns the subtraction between a series and other, element-wise (binary operator subtraction).

Callers

nothing calls this directly

Calls 3

_genericMathOpFunction · 0.90
$setValuesMethod · 0.80

Tested by

no test coverage detected