Loading...

vastorbit.VastColumn.str_slice

VastColumn.str_slice(start: int, step: int) VastFrame

Slices the VastColumn. The VastColumn will be transformed.

Parameters:
  • start (int) – Start of the slicing (1-indexed).

  • step (int) – Size of the slicing.

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 first 3 characters of name.

data["name"].str_slice(start = 1, step = 3)
Abc
name
Varchar(19)
1Mr
2Mr
3Mr
4Dr
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_extract() : Extracts the Regular Expression.