Loading...

verticapy.vDataColumn.str_slice#

vDataColumn.str_slice(start: int, step: int) vDataFrame#

Slices the vDataColumn. The vDataColumn will be transformed.

Parameters#

start: int

Start of the slicing.

step: int

Size of the slicing.

Returns#

vDataFrame

self._parent

Examples#

Let’s begin by importing VerticaPy.

import verticapy as vp

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

data = vp.vDataFrame(
    {
        "name": [
            'Mr. Steve Smith',
            'Mr. Charlie Dickens',
            'Mrs. Helen Ross',
            'Dr. Jack Smith',
        ]
    }
)

Let’s extract the first 3 alphabets of name.

data["name"].str_slice(start = 0, step =3)
Abc
name
Varchar(12)
100%
1Mr
2Mr
3Mr
4Dr

See also

vDataFrame.str_contains() : Validates the regular expression.
vDataFrame.str_count() : Counts occurrences matching the regular expression.
vDataFrame.str_replace() : Replaces the Regular Expression.
vDataFrame.str_extract() : Extracts the Regular Expression.