pyspark.sql.functions.soundex#

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

Returns the SoundEx encoding for a string

New in version 1.5.0.

Changed in version 3.4.0: Supports Spark Connect.

Parameters
colColumn or column name

target column to work on.

Returns
Column

SoundEx encoded 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|
+-------+----------+