Series.str.len
Obtain the length of each string element in a Series
Parameters | Type | Description | Default |
---|---|---|---|
options | Object | inplace: Whether to perform the operation in-place or not. | { inplace: false } |
Examples
Returns the length (number of character) of a string, and also return the length (number of elements) of Array
JavaScript
Browser
const dfd = require("danfojs-node")
let data = ["dog", 5,"cat","fog","mug","animals"]
let sf = new dfd.Series(data)
sf.str.len().print()
Output
╔═══╤═══╗
║ 0 │ 3 ║
╟───┼───╢
║ 1 │ 1 ║
╟───┼───╢
║ 2 │ 3 ║
╟───┼───╢
║ 3 │ 3 ║
╟───┼───╢
║ 4 │ 3 ║
╟───┼───╢
║ 5 │ 7 ║
╚═══╧═══╝
Last modified 1yr ago