verticapy.vDataColumn.str_extract#
- vDataColumn.str_extract(pat: str) vDataFrame #
Extracts the regular expression in each record of the vDataColumn. The vDataColumn will be transformed.
Parameters#
- pat: str
regular expression.
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 name prefix.
data["name"].str_extract(pat = "([A-Za-z])+\.")
AbcnameVarchar(19)100%1 Mr. 2 Mr. 3 Mrs. 4 Dr. 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_slice()
: Slices the Regular Expression.