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

Method isNa

src/danfojs-base/core/frame.ts:2039–2060  ·  view source on GitHub ↗

* Return a boolean, same-sized object indicating where elements are empty (NaN, undefined, null). * NaN, undefined and null values gets mapped to true, and everything else gets mapped to false. * @example * ``` * const df = new DataFrame([[1, 2], [3, 4]], { columns: ['A', 'B']})

()

Source from the content-addressed store, hash-verified

2037 * ```
2038 */
2039 isNa(): DataFrame {
2040 const newData = []
2041 for (let i = 0; i < this.values.length; i++) {
2042 const valueArr = this.values[i] as ArrayType1D
2043 const tempData = valueArr.map((value) => {
2044 if (utils.isEmpty(value)) {
2045 return true;
2046 } else {
2047 return false;
2048 }
2049 })
2050 newData.push(tempData)
2051 }
2052
2053 const df = new DataFrame(newData,
2054 {
2055 index: [...this.index],
2056 columns: [...this.columns],
2057 config: { ...this.config }
2058 });
2059 return df;
2060 }
2061
2062 /**
2063 * Replace all empty elements with a specified value. Replace params expect columns array to map to values array.

Callers

nothing calls this directly

Calls 2

isEmptyMethod · 0.80
mapMethod · 0.65

Tested by

no test coverage detected