MCPcopy Create free account
hub / github.com/javascriptdata/danfojs / len

Method len

src/danfojs-base/core/strings.ts:746–764  ·  view source on GitHub ↗
(options?: { inplace?: boolean })

Source from the content-addressed store, hash-verified

744 */
745 len(options?: { inplace?: boolean }): Series
746 len(options?: { inplace?: boolean }): Series | void {
747 const { inplace } = { inplace: false, ...options }
748 const newArr: Array<string | number> = [];
749 this.values.map((val) => {
750 if (utils.isEmpty(val)) {
751 newArr.push(NaN);
752 } else {
753 newArr.push(`${val}`.length);
754 }
755 });
756 if (inplace) {
757 this.series.$setValues(newArr as ArrayType1D)
758 this.series.print()
759 } else {
760 const sf = this.series.copy()
761 sf.$setValues(newArr as ArrayType1D)
762 return sf;
763 }
764 }
765
766}

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