Teradata Package for Python Function Reference on VantageCloud Lake - count_delimiters - 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 on VantageCloud Lake
- Deployment
- VantageCloud
- Edition
- Lake
- Product
- Teradata Package for Python
- Release Number
- 20.00.00.08
- Published
- November 2025
- ft:locale
- en-US
- ft:lastEdition
- 2025-12-05
- dita:id
- TeradataPython_FxRef_Lake_2000
- Product Category
- Teradata Vantage
- teradataml.dataframe.sql.DataFrameColumn.count_delimiters = count_delimiters(self, delimiter)
- DESCRIPTION:
Function to count the total number of occurrences of a specified delimiter.
PARAMETERS:
delimiter:
Required Argument.
Specifies the delimiter to count in the column values.
Types: str
RETURNS:
ColumnExpression.
EXAMPLES:
# Load sample data
>>> load_example_data("dataframe", "admissions_train")
>>> df = DataFrame("admissions_train")
# Create a DataFrame with a column containing delimiters.
>>> df1 = df.assign(delim_col = 'ab.c.def.g')
>>> df1
masters gpa stats programming admitted delim_col
id
38 yes 2.65 Advanced Beginner 1 ab.c.def.g
7 yes 2.33 Novice Novice 1 ab.c.def.g
26 yes 3.57 Advanced Advanced 1 ab.c.def.g
# Example 1: Count the number of periods in column 'delim_col'.
>>> res = df1.assign(dot_count = df1.delim_col.count_delimiters('.'))
>>> res
masters gpa stats programming admitted delim_col dot_count
id
38 yes 2.65 Advanced Beginner 1 ab.c.def.g 3
7 yes 2.33 Novice Novice 1 ab.c.def.g 3
26 yes 3.57 Advanced Advanced 1 ab.c.def.g 3
# Example 2: Count multiple delimiters in a string.
>>> df2 = df.assign(delim_col = 'a,b;c;d-e')
>>> res = df2.assign(
... comma_count = df2.delim_col.count_delimiters(','),
... semicolon_count = df2.delim_col.count_delimiters(';'),
... colon_count = df2.delim_col.count_delimiters(':'),
... dash_count = df2.delim_col.count_delimiters('-')
... )
>>> res
masters gpa stats programming admitted delim_col colon_count comma_count dash_count semicolon_count
id
38 yes 2.65 Advanced Beginner 1 a,b;c;d-e 0 1 1 2
7 yes 2.33 Novice Novice 1 a,b;c;d-e 0 1 1 2
26 yes 3.57 Advanced Advanced 1 a,b;c;d-e 0 1 1 2
5 no 3.44 Novice Novice 0 a,b;c;d-e 0 1 1 2