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

Method charAt

src/danfojs-base/core/strings.ts:160–178  ·  view source on GitHub ↗
(index = 0, options?: { inplace?: boolean })

Source from the content-addressed store, hash-verified

158 */
159 charAt(index: number, options?: { inplace?: boolean }): Series
160 charAt(index = 0, options?: { inplace?: boolean }): Series | void {
161 const { inplace } = { inplace: false, ...options }
162 const newArr: Array<string | number> = [];
163 this.values.map((val) => {
164 if (utils.isEmpty(val)) {
165 newArr.push(NaN);
166 } else {
167 newArr.push(`${val}`.charAt(index));
168 }
169 });
170 if (inplace) {
171 this.series.$setValues(newArr as ArrayType1D)
172 this.series.print()
173 } else {
174 const sf = this.series.copy()
175 sf.$setValues(newArr as ArrayType1D)
176 return sf;
177 }
178 }
179
180 /**
181 * Joins specified `other` with values in the Series.

Callers 4

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