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

Method sub

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

Source from the content-addressed store, hash-verified

301 */
302 sub(other: Series | number | Array<number>, options?: { inplace?: boolean }): Series
303 sub(other: Series | number | Array<number>, options?: { inplace?: boolean }): Series | void {
304 const { inplace } = { inplace: false, ...options }
305
306 if (this.dtypes[0] == "string") ErrorThrower.throwStringDtypeOperationError("sub")
307
308 const newData = _genericMathOp({ ndFrame: this, other, operation: "sub" })
309
310 if (inplace) {
311 this.$setValues(newData as ArrayType1D)
312 } else {
313 return utils.createNdframeFromNewDataWithOldProps({ ndFrame: this, newData, isSeries: true }) as Series
314 }
315
316 }
317
318 /**
319 * Return Multiplication of series and other, element-wise (binary operator mul).

Callers

nothing calls this directly

Calls 3

_genericMathOpFunction · 0.90
$setValuesMethod · 0.80

Tested by

no test coverage detected