Loading...

vastorbit.VastColumn.str_extract

VastColumn.str_extract(pat: str) VastFrame

Extracts the regular expression in each record of the VastColumn. 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(
    {
        "name": [
            'Mr. Steve Smith',
            'Mr. Charlie Dickens',
            'Mrs. Helen Ross',
            'Dr. Jack Smith',
        ]
    }
)

Let’s extract the name prefix.

data["name"].str_extract(pat = r"([A-Za-z])+\.")
Abc
name
Varchar(19)
1Mr.
2Mr.
3Dr.
4Mrs.
Rows: 1-4 | Column: name | Type: varchar(19)

See also

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