pyspark.sql.functions.soundex#

pyspark.sql.functions.soundex(col)[source]#

Returns the SoundEx encoding for a string

Added in version 1.5.0.

Changed in version 3.4.0: Supports Spark Connect.

Parameters:
colColumn or column name

target column to work on. A column that evaluates to a string.

Returns:
Column

SoundEx encoded string. Returns a column that evaluates to a string.

Examples

>>> import pyspark.sql.functions as sf
>>> df = spark.createDataFrame([("Peters",),("Uhrbach",)], ["s"])
>>> df.select("*", sf.soundex("s")).show()
+-------+----------+
|      s|soundex(s)|
+-------+----------+
| Peters|      P362|
|Uhrbach|      U612|
+-------+----------+