Teradata Package for Python Function Reference | 20.00 - soundex - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.
Teradata® Package for Python Function Reference - 20.00
- Deployment
- VantageCloud
- VantageCore
- Edition
- Enterprise
- IntelliFlex
- VMware
- Product
- Teradata Package for Python
- Release Number
- 20.00.00.03
- Published
- December 2024
- ft:locale
- en-US
- ft:lastEdition
- 2024-12-19
- dita:id
- TeradataPython_FxRef_Enterprise_2000
- lifecycle
- latest
- Product Category
- Teradata Vantage
- teradataml.dataframe.sql.DataFrameColumn.soundex = soundex()
- DESCRIPTION:
Function returns a character string that represents the Soundex code for
string_expression.
Soundex is a system that codes surnames having the same or similar sounds,
but variant spellings. The Soundex system was first used by the National
Archives in 1880 to index the United States census.
Soundex codes begin with the first letter of the surname followed by a three-digit
code. Zeros are added to names that do not have enough letters.
RAISES:
TypeError, ValueError, TeradataMlException
RETURNS:
DataFrameColumn
EXAMPLES:
# Load the data to run the example.
>>> load_example_data("dataframe", "admissions_train")
# Create a DataFrame on 'admissions_train' table.
>>> admissions_train = DataFrame("admissions_train")
>>> admissions_train
masters gpa stats programming admitted
id
3 no 3.70 Novice Beginner 1
4 yes 3.50 Beginner Novice 1
2 yes 3.76 Beginner Beginner 0
1 yes 3.95 Beginner Beginner 0
# Example 1: Returns the Soundex code for character string in "programming" column and pass
# the Function object as input to DataFrame.assign().
>>> res = df.assign(col = df.programming.soundex())
>>> print(res)
masters gpa stats programming admitted col
id
3 no 3.70 Novice Beginner 1 B256
4 yes 3.50 Beginner Novice 1 N120
2 yes 3.76 Beginner Beginner 0 B256
1 yes 3.95 Beginner Beginner 0 B256
# Example 2: Executed soundex() function on "programming" column and filtered computed
# values which are equal to 'B256'.
>>> print(df[df.programming.soundex() == "B256"])
masters gpa stats programming admitted
id
3 no 3.70 Novice Beginner 1
2 yes 3.76 Beginner Beginner 0
1 yes 3.95 Beginner Beginner 0