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

Method inferDtype

src/danfojs-base/shared/utils.ts:260–271  ·  view source on GitHub ↗

* Infer data type from an array or array of arrays * @param arr An array or array of arrays

(arr: ArrayType1D | ArrayType2D)

Source from the content-addressed store, hash-verified

258 * @param arr An array or array of arrays
259 */
260 inferDtype(arr: ArrayType1D | ArrayType2D) {
261 const self = this;
262 if (this.is1DArray(arr)) {
263 return [this.$typeChecker(arr)];
264 } else {
265 const arrSlice = this.transposeArray(arr.slice(0, config.getDtypeTestLim))
266 const dtypes = arrSlice.map((innerArr) => {
267 return self.$typeChecker(innerArr as any);
268 });
269 return dtypes;
270 }
271 }
272
273 /**
274 * Private type checker used by inferDtype function

Callers 6

utils.test.jsFile · 0.80
$setColumnDataMethod · 0.80
addColumnMethod · 0.80
$setDtypesMethod · 0.80
$setValuesMethod · 0.80
utils.test.tsFile · 0.80

Calls 5

is1DArrayMethod · 0.95
$typeCheckerMethod · 0.95
transposeArrayMethod · 0.95
sliceMethod · 0.80
mapMethod · 0.65

Tested by

no test coverage detected