danfo.Series.str.substring(startIndex, endIndex) [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 |
Returns
return Series
Example
Obtain the substring from index 2 to index 4 of the string elements in a Series
const dfd = require("danfojs-node")let data = ['lower part ', ' CAPITALS city', ' this is a sentence', ' SwAp CaSe']let sf = new dfd.Series(data)sf.str.substring(2, 4).print()
╔═══╤══════════════════════╗║ │ 0 ║╟───┼──────────────────────╢║ 0 │ we ║╟───┼──────────────────────╢║ 1 │ AP ║╟───┼──────────────────────╢║ 2 │ hi ║╟───┼──────────────────────╢║ 3 │ Sw ║╚═══╧══════════════════════╝