soundex_matches

In [ ]:
soundex_matches(expr1, 
                expr2,)

Generates and compares Soundex encodings of two strings and returns the number of the matching characters. The result of a comparison ranges from 0 (zero matches) to 4 (an exact match).

Parameters

Name Type Optional Description
expr1
object
Expression.
expr2
object
Expression.

Returns

str_sql : SQL expression.

Example

In [4]:
from verticapy import *
df = tablesample({"x": ['hello', 'apple', 'heroes', 'allo']}).to_vdf()
display(df)
Abc
x
Varchar(6)
1hello
2apple
3heroes
4allo
Rows: 1-4 | Column: x | Type: varchar(6)
In [5]:
# Importing the stats module
import verticapy.stats as st

# Applying the week function
df["soundex_matches_x"] = st.soundex_matches(df["x"], 'heyllow')
display(df)
Abc
x
Varchar(6)
123
soundex_matches_x
Integer
1hello4
2apple1
3heroes2
4allo3
Rows: 1-4 | Columns: 2