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

Method lastIndexOf

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

Source from the content-addressed store, hash-verified

395 */
396 lastIndexOf(str: string, options?: { inplace?: boolean }): Series
397 lastIndexOf(str = "", options?: { inplace?: boolean }): Series | void {
398 const { inplace } = { inplace: false, ...options }
399 const newArr: Array<string | number> = [];
400 this.values.map((val) => {
401 if (utils.isEmpty(val)) {
402 newArr.push(NaN);
403 } else {
404 newArr.push(`${val}`.lastIndexOf(str));
405 }
406 });
407 if (inplace) {
408 this.series.$setValues(newArr as ArrayType1D)
409 this.series.print()
410 } else {
411 const sf = this.series.copy()
412 sf.$setValues(newArr as ArrayType1D)
413 return sf;
414 }
415 }
416
417
418 /**

Callers 2

strings.test.jsFile · 0.80
strings.test.tsFile · 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