← replace operator page · string/replace/ds_two/manual_ex_1
pandas ✅ · DuckDB ✅
replace(DS_1, "ello", "i"): ello replaced by i in every value.
String pattern replacement, Example 1, output verbatim: "Replaces all the occurrences of a specified string-pattern (pattern1) with another one (pattern2)."
hello world, say hello and hello! give hi world, say hi and hi!; he has no ello and is kept.
DS_r := replace (DS_1,"ello","i");
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | hello world |
| 2 | A | say hello |
| 3 | A | he |
| 4 | A | hello! |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "String", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | hi world |
| 2 | A | say hi |
| 3 | A | he |
| 4 | A | hi! |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "String", "role": "Measure"}
]
}
]
}