Loading...

vastorbit.VastColumn.str_contains

VastColumn.str_contains(pat: str) VastFrame

Verifies if the regular expression is in each of the VastColumn records. The VastColumn will be transformed.

Parameters:

pat (str) – Regular expression.

Returns:

self._parent

Return type:

VastFrame

Examples

Let’s begin by importing vastorbit.

import vastorbit as vo

Let’s generate a small dataset using the following data:

data = vo.VastFrame(
    {
        "rollno": ['1', '2', '3', '4'],
        "subjects": [
            'English, Math',
            'English, Math, Computer',
            'Math, Computer, Science',
            'Math, Science',
        ],
    }
)

Let’s check if subjects contain “English”.

data["subjects"].str_contains(pat = "English").select(
    [
        "rollno",
        "subjects as has_english",
    ]
)
Abc
rollno
Varchar(1)
0|1
has_english
Boolean
14
21
32
43
Rows: 1-4 | Columns: 2

See also

VastFrame.str_count() : Counts occurrences matching the regular expression.
VastFrame.str_extract() : Extracts the Regular Expression.
VastFrame.str_replace() : Replaces the Regular Expression.
VastFrame.str_slice() : Slices the Regular Expression.