MCPcopy Index your code
hub / github.com/javascriptdata/danfojs / abs

Method abs

src/danfojs-base/core/series.ts:1152–1168  ·  view source on GitHub ↗
(options?: { inplace?: boolean })

Source from the content-addressed store, hash-verified

1150 */
1151 abs(options?: { inplace?: boolean }): Series
1152 abs(options?: { inplace?: boolean }): Series | void {
1153 const { inplace } = { inplace: false, ...options }
1154
1155 if (this.dtypes[0] == "string") ErrorThrower.throwStringDtypeOperationError("abs")
1156 let newValues;
1157
1158
1159 newValues = this.values.map(val => Math.abs(val as number));
1160
1161 if (inplace) {
1162 this.$setValues(newValues as ArrayType1D)
1163 } else {
1164 const sf = this.copy();
1165 sf.$setValues(newValues as ArrayType1D)
1166 return sf;
1167 }
1168 }
1169
1170 /**
1171 * Returns the cumulative sum over a Series

Callers

nothing calls this directly

Calls 4

copyMethod · 0.95
$setValuesMethod · 0.80
mapMethod · 0.65
absMethod · 0.65

Tested by

no test coverage detected