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

Method abs

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

Source from the content-addressed store, hash-verified

1537 */
1538 abs(options?: { inplace?: boolean }): DataFrame
1539 abs(options?: { inplace?: boolean }): DataFrame | void {
1540 const { inplace } = { inplace: false, ...options }
1541
1542 const newData = (this.values as number[][]).map(arr => arr.map(val => Math.abs(val)))
1543 if (inplace) {
1544 this.$setValues(newData)
1545 } else {
1546 return new DataFrame(newData, {
1547 index: [...this.index],
1548 columns: [...this.columns],
1549 dtypes: [...this.dtypes],
1550 config: { ...this.config }
1551 })
1552 }
1553 }
1554
1555 /**
1556 * Rounds all element in the DataFrame to specified number of decimal places.

Callers

nothing calls this directly

Calls 3

$setValuesMethod · 0.80
mapMethod · 0.65
absMethod · 0.65

Tested by

no test coverage detected