Powered By GitBook
Series.str.replace
Replace a word or character(s) in a String element
danfo.Series.str.replace(searchValue, replaceValue, options) [source]
Parameters
Type
Description
Default
searchValue
string
String | Character value to replace. Supports regex.
""
replaceValue
String
string to replace the searched string
""
options
Object
inplace: Whether to perform the operation in-place or not.
{
inplace: false
}
Returns: Series
Node
Browse
1
const dfd = require("danfojs-node")
2
3
let data = ['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe']
4
let sf = new dfd.Series(data)
5
sf.str.replace("A", "XXX").print()
Copied!
1
Copied!
Output
1
╔═══╤══════════════════════╗
2
║ │ 0 ║
3
╟───┼──────────────────────╢
4
║ 0 │ lower ║
5
╟───┼──────────────────────╢
6
║ 1 │ CXXXPITALS ║
7
╟───┼──────────────────────╢
8
║ 2 │ this is a sentence ║
9
╟───┼──────────────────────╢
10
║ 3 │ SwXXXpCaSe ║
11
╚═══╧══════════════════════╝
Copied!
Last modified 24d ago
Copy link