Teradata Package for Python Function Reference on VantageCloud Lake - parse_url - 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.04
- Published
- March 2025
- ft:locale
- en-US
- ft:lastEdition
- 2025-04-11
- dita:id
- TeradataPython_FxRef_Lake_2000
- Product Category
- Teradata Vantage
- teradataml.dataframe.sql.DataFrameColumn.parse_url = parse_url(self, url_part)
- DESCRIPTION:
Extracts a specific part from the URL.
PARAMETERS:
url_part:
Required Argument.
Specifies which part to be extracted.
Permitted Values: HOST, PATH, QUERY, REF, PROTOCOL, FILE, AUTHORITY, USERINFO
Type: str or ColumnExpression
Returns:
ColumnExpression
EXAMPLES:
# Load the data to run the example.
>>> load_example_data("teradataml", "url_data")
# Create a DataFrame on 'url_data' table.
>>> df = DataFrame("url_data")
>>> df
urls part
id
3 https://www.facebook.com HOST
6 smtp://user:password@smtp.example.com:21/file.txt USERINFO
4 https://teracloud-pod-services-pod-account-service.dummyvalu QUERY
2 https://example.net/path4/path5/path6?query4=value4#fragment REF
0 http://example.com:8080/path FILE
1 ftp://example.net:21/path PATH
5 http://pg.example.ml/path150#fragment90 AUTHORITY
7 https://www.google.com PROTOCOL
# Example 1: Extract components from column 'urls' using column 'part'
>>> df.assign(col = df.urls.parse_url(df.part))
urls part col
id
3 https://www.facebook.com HOST www.facebook.com
6 smtp://user:password@smtp.example.com:21/file.txt USERINFO user:password
4 https://teracloud-pod-services-pod-account-service.dummyvalu QUERY None
2 https://example.net/path4/path5/path6?query4=value4#fragment REF fragment
0 http://example.com:8080/path FILE /path
1 ftp://example.net:21/path PATH /path
5 http://pg.example.ml/path150#fragment90 AUTHORITY pg.example.ml
7 https://www.google.com PROTOCOL https
>>>