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

Method slice

src/danfojs-base/core/strings.ts:540–558  ·  view source on GitHub ↗
(startIndex = 0, endIndex = 1, options?: { inplace?: boolean })

Source from the content-addressed store, hash-verified

538 */
539 slice(startIndex: number, endIndex: number, options?: { inplace?: boolean }): Series
540 slice(startIndex = 0, endIndex = 1, options?: { inplace?: boolean }): Series | void {
541 const { inplace } = { inplace: false, ...options }
542 const newArr: Array<string | number> = [];
543 this.values.map((val) => {
544 if (utils.isEmpty(val)) {
545 newArr.push(NaN);
546 } else {
547 newArr.push(`${val}`.slice(startIndex, endIndex));
548 }
549 });
550 if (inplace) {
551 this.series.$setValues(newArr as ArrayType1D)
552 this.series.print()
553 } else {
554 const sf = this.series.copy()
555 sf.$setValues(newArr as ArrayType1D)
556 return sf;
557 }
558 }
559
560 /**
561 * Splits a string into an values of substrings

Callers 11

strings.test.jsFile · 0.80
toStringMethod · 0.80
capitalizeMethod · 0.80
_locFunction · 0.80
constructorMethod · 0.80
basicMethod · 0.80
inferDtypeMethod · 0.80
$typeCheckerMethod · 0.80
shuffleMethod · 0.80
groupMathLogMethod · 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