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

Method indexOf

src/danfojs-base/core/strings.ts:362–380  ·  view source on GitHub ↗
(str = "", options?: { inplace?: boolean })

Source from the content-addressed store, hash-verified

360 */
361 indexOf(str: string, options?: { inplace?: boolean }): Series
362 indexOf(str = "", options?: { inplace?: boolean }): Series | void {
363 const { inplace } = { inplace: false, ...options }
364 const newArr: Array<number> = [];
365 this.values.map((val) => {
366 if (utils.isEmpty(val)) {
367 newArr.push(NaN);
368 } else {
369 newArr.push(`${val}`.indexOf(str));
370 }
371 });
372 if (inplace) {
373 this.series.$setValues(newArr as ArrayType1D)
374 this.series.print()
375 } else {
376 const sf = this.series.copy()
377 sf.$setValues(newArr as ArrayType1D)
378 return sf;
379 }
380 }
381
382 /**
383 * Returns the position of the last found occurrence of a specified value in a string

Callers 15

strings.test.jsFile · 0.80
tablePlotFunction · 0.80
$getColumnDataMethod · 0.80
$setColumnDataMethod · 0.80
$getColumnDtypeMethod · 0.80
addMethod · 0.80
subMethod · 0.80
mulMethod · 0.80
divMethod · 0.80
divNoNanMethod · 0.80
powMethod · 0.80
modMethod · 0.80

Calls 5

isEmptyMethod · 0.80
$setValuesMethod · 0.80
mapMethod · 0.65
printMethod · 0.65
copyMethod · 0.65

Tested by

no test coverage detected