Series.str.replace

Replace a word or character(s) in a String element

danfo.Series.str.replace(searchValue, replaceValue) [source]

Parameters

Type

Description

Default

searchValue

string

the string to search for

""

replaceValue

String

string to replace the searched string

""

Returns: Series

Node
Browse
Node
const dfd = require("danfojs-node")
let data = ['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe']
let sf = new dfd.Series(data)
sf.str.replace("A", "XXX").print()
Browse
Output
Output
╔═══╤══════════════════════╗
║ │ 0 ║
╟───┼──────────────────────╢
║ 0 │ lower ║
╟───┼──────────────────────╢
║ 1 │ CXXXPITALS ║
╟───┼──────────────────────╢
║ 2 │ this is a sentence ║
╟───┼──────────────────────╢
║ 3 │ SwXXXpCaSe ║
╚═══╧══════════════════════╝