vDataFrame[].str_extract

In [ ]:
vDataFrame[].str_extract(pat: str)

Extracts the regular expression in each record of the vcolumn. The vcolumn will be transformed.

Parameters

Name Type Optional Description
pat
str
❌
regular expression.

Returns

vDataFrame : self.parent

Example

In [84]:
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 [85]:
titanic["name"].str_extract(pat = " ([A-Za-z])+\.")
Abc
name
Varchar(164)
1 Miss.
2 Mr.
3 Mrs.
4 Mr.
5 Mr.
6 Col.
7 Mr.
8 Mr.
9 Mr.
10 Mr.
11 Mr.
12 Mr.
13 Mr.
14 Mr.
15 Dr.
16 Major.
17 Mr.
18 Mr.
19 Mr.
20 Mr.
21 Mr.
22 Mr.
23 Mr.
24 Mr.
25 Mr.
26 Mr.
27 Mr.
28 Mr.
29 Mr.
30 Capt.
31 Mr.
32 Mr.
33 Mr.
34 Mr.
35 Miss.
36 Mr.
37 Mr.
38 Mr.
39 Mr.
40 Mr.
41 Mr.
42 Mr.
43 Mr.
44 Mr.
45 Mr.
46 Mr.
47 Mr.
48 Mr.
49 Mr.
50 Mr.
51 Mr.
52 Mr.
53 Mr.
54 Mr.
55 Mr.
56 Mr.
57 Miss.
58 Mr.
59 Mr.
60 Mr.
61 Mr.
62 Mr.
63 Mr.
64 Mr.
65 Mr.
66 Mr.
67 Mr.
68 Mr.
69 Mr.
70 Mr.
71 Mr.
72 Mr.
73 Dr.
74 Mr.
75 Mr.
76 Mr.
77 Mr.
78 Mr.
79 Mr.
80 Mr.
81 Mr.
82 Mr.
83 Mr.
84 Mr.
85 Mr.
86 Mr.
87 Jonkheer.
88 Mr.
89 Mr.
90 Mr.
91 Mr.
92 Mr.
93 Mr.
94 Mr.
95 Mr.
96 Mr.
97 Mr.
98 Mr.
99 Mr.
100 Mr.
Out[85]:
Rows: 1-100 of 1234 | Column: name | Type: varchar(164)

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_replace Replaces the regular expression matches in each of the vcolumn record by an input value.
vDataFrame[].str_slice Slices the vcolumn.