Replace
Base classes
| Name |
Children |
Inherits |
TextOp datacook.engine.ops.strings
|
|
|
⋔ Inheritance diagram
graph TD
4162168059["strings.Replace"]
4127298390["strings.TextOp"]
2451904138["series.SeriesOp"]
124287307["series.ColumnOp"]
1539482213["base.Op"]
2751680898["builtins.object"]
4127298390 --> 4162168059
2451904138 --> 4127298390
124287307 --> 2451904138
1539482213 --> 124287307
2751680898 --> 1539482213
🛈 DocStrings
Bases: TextOp
Source code in src/datacook/engine/ops/strings.py
| class Replace(TextOp):
id = "str_replace"
title = _("Replace text")
description = _("Replace a text or a regular expression in text columns.")
icon = "mdi.find-replace"
method = "replace"
positional = ("pat", "repl")
class Params(series.ColumnParams):
pat: str = Field(title=N_("Search for"), min_length=1)
repl: str = Field("", title=N_("Replace with"))
regex: bool = Field(
False,
title=N_("Regular expression"),
description=N_("Groups can be used in the replacement as \\1, \\2, ..."),
)
case: bool | None = Field(None, title=N_("Case sensitive"))
n: int = Field(-1, title=N_("Replacements per cell"), ge=-1, description=N_("-1: all"))
|
:fa-brands-github: Show source on GitHub