vDataFrame[].str_slice

In [ ]:
vDataFrame[].str_slice(start: int, 
                       step: int)

Slices the vcolumn. The vcolumn will be transformed.

Parameters

Name Type Optional Description
start
int
❌
Start of the slicing.
step
int
❌
Size of the slicing.

Returns

vDataFrame : self.parent

Example

In [88]:
from verticapy.datasets import load_titanic
titanic = load_titanic()
display(titanic["name"])
Abc
Varchar(164)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Rows: 1-100 of 1234 | Column: name | Type: varchar(164)
In [89]:
titanic["name"].str_slice(start = 0, step = 3)
Abc
name
Varchar(12)
1Al
2Al
3Al
4An
5Ar
6As
7Ba
8Ba
9Be
10Bi
11Bl
12Bo
13Br
14Br
15Br
16Bu
17Ca
18Ca
19Ca
20Ca
21Ca
22Ca
23Ch
24Ch
25Cl
26Cl
27Co
28Co
29Cr
30Cr
31Cu
32Da
33Do
34Du
35Ev
36Fa
37Fo
38Fo
39Fo
40Fr
41Fr
42Fu
43Ge
44Gi
45Go
46Gr
47Gu
48Ha
49Ha
50Ha
51Ha
52He
53Hi
54Hi
55Ho
56Ho
57Is
58Jo
59Ju
60Ke
61Ke
62Ke
63Kl
64Le
65Lo
66Lo
67Ma
68Ma
69Mc
70Mc
71Me
72Mi
73Mi
74Mo
75Mo
76Na
77Ne
78Ni
79Os
80Ov
81Pa
82Pa
83Pa
84Pe
85Pe
86Po
87Re
88Ri
89Ro
90Ro
91Ro
92Ro
93Ro
94Ro
95Ry
96Si
97Sm
98Sm
99Sm
100Sm
Out[89]:
Rows: 1-100 of 1234 | Column: name | Type: varchar(12)

See Also

vDataFrame[].str_contains Verifies if the regular expression is in each of the vcolumn records.
vDataFrame[].str_count Computes the regular expression count match in each record of the vcolumn.
vDataFrame[].str_extract Extracts the regular expression in each record of the vcolumn.
vDataFrame[].str_replace Replaces the regular expression matches in each of the vcolumn record by an input value.