Skip to content

featurebyte.ViewColumn.str.contains

contains(
pat: str,
case: bool=True
) -> FrozenSeries

Description

Checks whether each string element contains the provided substring pattern.

Parameters

  • pat: str
    Substring pattern.

  • case: bool
    default: True
    Whether the check is case-sensitive.

Returns

  • FrozenSeries
    A new Column or Feature object.

Examples

Check whether the BrowserUserAgent column contains "x64":

>>> view = catalog.get_view("GROCERYCUSTOMER")
>>> view["BrowserUserAgent_x64"] = view["BrowserUserAgent"].str.contains("x64")
>>> view.preview(5).filter(regex="BrowserUserAgent")
                                    BrowserUserAgent  BrowserUserAgent_x64
0  Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.3...                 False
1  Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:6...                  True
2  Mozilla/5.0 (Windows NT 10.0; Win64; x64) Appl...                  True
3  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4...                 False
4  Mozilla/5.0 (Windows NT 6.1; Win64; x64) Apple...                  True