Teradata Package for Python Function Reference | 20.00 - char - 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
- Product Category
- Teradata Vantage
- teradataml.dataframe.sql.DataFrameColumn.char = char()
- DESCRIPTION:
Function returns the Latin ASCII character of a given numeric code value.
ALTERNATE NAME:
chr
NOTES:
1. If the value in column is null, then result is null.
2. Numeric value must be zero or greater. If value in the column is greater
than 255, an operation of value mod 256 is executed to return a value
between 0 and 255.
RAISES:
TypeError, ValueError, TeradataMlException
RETURNS:
DataFrameColumn
EXAMPLES:
# Load the data to execute the example.
>>> load_example_data("dataframe", "employee_info")
# Create a DataFrame on 'employee_info' table.
>>> df = DataFrame("employee_info")
>>> print(df)
first_name marks dob joined_date
employee_no
100 abcd None None None
101 abcde None None 02/12/05
112 None None None 18/12/05
# Example 1: Returns the Latin ASCII character for values in "employee_no" column and pass
# it as input to DataFrame.assign().
>>> df = df.assign(col = df.employee_no.char())
>>> print(df)
first_name marks dob joined_date col
employee_no
100 abcd None None None d
101 abcde None None 02/12/05 e
112 None None None 18/12/05 p
# Example 2: Executed char() function on "employee_no" column and filtered computed
# values which are equal to 'p'.
>>> print(df[df.employee_no.char() == 'p'])
first_name marks dob joined_date col
employee_no
112 None None None 18/12/05 p