Powered By GitBook
Series.str.split
Split string around a given separator/delimiter. The array of strings are then converted to a string.
danfo.Series.str.split(splitVal, options) [source]
Parameters
Type
Description
Default
splitVal
String
separator or delimiter used to split the string
" "
options
Object
inplace: Whether to perform operation in-place or not.
{ inplace: false }
Returns
return Series
Examples
Split the string value in the Series by space and obtain the Series values
JavaScript
Browser
1
const dfd = require("danfojs-node")
2
3
let data = ["king of the music","the lamba queen","I love the hat"]
4
let sf = new dfd.Series(data)
5
console.log(sf.str.split().values)
Copied!
1
Copied!
OUTPUT: [ 'king,of,the,music', 'the,lamba,queen', 'I,love,the,hat' ]
JavaScript
Browser
1
const dfd = require("danfojs-node")
2
3
let data = ["king_of_the_music","the_lamba_queen","I_love_the_hat"]
4
let sf = new dfd.Series(data)
5
sf.str.split("_").print()
Copied!
1
Copied!
Output
1
╔═══╤══════════════════════╗
2
║ │ 0 ║
3
╟───┼──────────────────────╢
4
║ 0 │ king,of,the,music ║
5
╟───┼──────────────────────╢
6
║ 1 │ the,lamba,queen ║
7
╟───┼──────────────────────╢
8
║ 2 │ I,love,the,hat ║
9
╚═══╧══════════════════════╝
Copied!
Last modified 13d ago
Copy link