vDataFrame[].str_count

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

Computes the regular expression count match 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 [80]:
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 [81]:
titanic["name"].str_count(pat = " ([A-Za-z])+\.")
123
name
Integer
11
21
31
41
51
61
71
81
91
101
111
121
131
141
151
161
171
181
191
201
211
221
231
241
251
261
271
281
291
301
311
321
331
341
351
361
371
381
391
401
411
421
431
441
451
461
471
481
491
501
511
521
531
541
551
561
571
581
591
601
611
621
631
641
651
661
671
681
691
701
711
721
731
741
751
761
771
781
791
801
811
821
831
841
851
861
871
881
891
901
911
921
931
941
951
961
971
981
991
1001
Out[81]:
Rows: 1-100 of 1234 | Column: name | Type: integer

See Also

vDataFrame[].str_contains Verifies if the regular expression is in each of the vcolumn records.
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.
vDataFrame[].str_slice Slices the vcolumn.