Powered By GitBook
Series.str.substring
Obtain the substring of each element in a series
danfo.Series.str.substring(startIndex, endIndex, options) [source]
Parameters
Type
Description
Default
startIndex
Number
specify the index to start obtaining the substring
0
endIndex
Number
specify the index to end the substring
1
options
Object
inplace: Whether to perform the operation in-place or not.
{
inplace: false
}
Returns
return Series
Example
Obtain the substring from index 2 to index 4 of the string elements in a Series
Node
Browser
1
const dfd = require("danfojs-node")
2
3
let data = ['lower part ', ' CAPITALS city', ' this is a sentence', ' SwAp CaSe']
4
let sf = new dfd.Series(data)
5
sf.str.substring(2, 4).print()
Copied!
1
Copied!
Output
1
╔═══╤══════════════════════╗
2
║ │ 0 ║
3
╟───┼──────────────────────╢
4
║ 0 │ we ║
5
╟───┼──────────────────────╢
6
║ 1 │ AP ║
7
╟───┼──────────────────────╢
8
║ 2 │ hi ║
9
╟───┼──────────────────────╢
10
║ 3 │ Sw ║
11
╚═══╧══════════════════════╝
Copied!
Last modified 24d ago
Copy link