featurebyte.ViewColumn.str.replace¶
Description¶
Replaces the substring within each string element.
Parameters¶
- pat: str
Substring to match. - repl: str
Replacement string.
Returns¶
- FrozenSeries
A new Column or Feature object.
Examples¶
Replace "Windows" with "Win" in the BrowserUserAgent column:
>>> view = catalog.get_view("GROCERYCUSTOMER")
>>> view["BrowserUserAgentNew"] = view["BrowserUserAgent"].str.replace("Windows", "Win")
>>> view.preview(5).filter(regex="BrowserUserAgent")
BrowserUserAgent BrowserUserAgentNew
0 Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.3... Mozilla/5.0 (Win NT 6.1) AppleWebKit/537.36 (K...
1 Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:6... Mozilla/5.0 (Win NT 10.0; Win64; x64; rv:66.0)...
2 Mozilla/5.0 (Windows NT 10.0; Win64; x64) Appl... Mozilla/5.0 (Win NT 10.0; Win64; x64) AppleWeb...
3 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4... Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4...
4 Mozilla/5.0 (Windows NT 6.1; Win64; x64) Apple... Mozilla/5.0 (Win NT 6.1; Win64; x64) AppleWebK...