Powered By GitBook
Series.str.len
Obtain the length of each string element in a Series
danfo.Series.str.len(options) [source]
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
1
const dfd = require("danfojs-node")
2
3
let data = ["dog", 5,"cat","fog","mug","animals"]
4
let sf = new dfd.Series(data)
5
sf.str.len().print()
Copied!
1
Copied!
Output
1
╔═══╤═══╗
2
║ 0 │ 3 ║
3
╟───┼───╢
4
║ 1 │ 1 ║
5
╟───┼───╢
6
║ 2 │ 3 ║
7
╟───┼───╢
8
║ 3 │ 3 ║
9
╟───┼───╢
10
║ 4 │ 3 ║
11
╟───┼───╢
12
║ 5 │ 7 ║
13
╚═══╧═══╝
Copied!
Last modified 13d ago
Copy link