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

Method round

src/danfojs-base/core/frame.ts:1573–1597  ·  view source on GitHub ↗
(dp: number = 1, options?: { inplace: boolean })

Source from the content-addressed store, hash-verified

1571 */
1572 round(dp: number, options?: { inplace: boolean }): DataFrame
1573 round(dp: number = 1, options?: { inplace: boolean }): DataFrame | void {
1574 const { inplace } = { inplace: false, ...options }
1575
1576 if (this.$frameIsNotCompactibleForArithmeticOperation()) {
1577 throw Error("TypeError: round operation is not supported for string dtypes");
1578 }
1579
1580 if (typeof dp !== "number") {
1581 throw Error("ParamError: dp must be a number");
1582 }
1583
1584 const newData = utils.round(this.values as number[], dp, false);
1585
1586 if (inplace) {
1587 this.$setValues(newData)
1588 } else {
1589 return new DataFrame(
1590 newData,
1591 {
1592 index: [...this.index],
1593 columns: [...this.columns],
1594 config: { ...this.config }
1595 })
1596 }
1597 }
1598
1599 /**
1600 * Returns cumulative product accross specified axis.

Callers

nothing calls this directly

Calls 3

$setValuesMethod · 0.80
roundMethod · 0.65

Tested by

no test coverage detected