MCPcopy Index your code
hub / github.com/javascriptdata/danfojs / $checkAndCleanValues

Method $checkAndCleanValues

src/danfojs-base/core/series.ts:474–482  ·  view source on GitHub ↗

* Checks if the array value passed has a compatible dtype, removes NaN values, and if * boolean values are present, converts them to integer values.

(values: ArrayType1D, operation: string)

Source from the content-addressed store, hash-verified

472 * boolean values are present, converts them to integer values.
473 */
474 private $checkAndCleanValues(values: ArrayType1D, operation: string): number[] {
475 if (this.dtypes[0] == "string") ErrorThrower.throwStringDtypeOperationError(operation)
476 values = utils.removeMissingValuesFromArray(values);
477
478 if (this.dtypes[0] == "boolean") {
479 values = (utils.mapBooleansToIntegers(values as boolean[], 1) as ArrayType1D);
480 }
481 return values as number[]
482 }
483
484 /**
485 * Returns the mean of elements in Series.

Callers 8

meanMethod · 0.95
medianMethod · 0.95
modeMethod · 0.95
minMethod · 0.95
maxMethod · 0.95
sumMethod · 0.95
stdMethod · 0.95
varMethod · 0.95

Calls 2

mapBooleansToIntegersMethod · 0.80

Tested by

no test coverage detected