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

Method repeat

src/danfojs-base/core/strings.ts:469–487  ·  view source on GitHub ↗
(num = 1, options?: { inplace?: boolean })

Source from the content-addressed store, hash-verified

467 */
468 repeat(num: number, options?: { inplace?: boolean }): Series
469 repeat(num = 1, options?: { inplace?: boolean }): Series | void {
470 const { inplace } = { inplace: false, ...options }
471 const newArr: Array<string | number> = [];
472 this.values.map((val) => {
473 if (utils.isEmpty(val)) {
474 newArr.push(NaN);
475 } else {
476 newArr.push(`${val}`.repeat(num));
477 }
478 });
479 if (inplace) {
480 this.series.$setValues(newArr as ArrayType1D)
481 this.series.print()
482 } else {
483 const sf = this.series.copy()
484 sf.$setValues(newArr as ArrayType1D)
485 return sf;
486 }
487 }
488
489
490 /**

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