Teradata Package for Python Function Reference on VantageCloud Lake - from_byte - 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.03
- Published
- December 2024
- ft:locale
- en-US
- ft:lastEdition
- 2024-12-19
- dita:id
- TeradataPython_FxRef_Lake_2000
- Product Category
- Teradata Vantage
- teradataml.dataframe.sql.DataFrameColumn.from_byte = from_byte(self, encoding='base10')
- DESCRIPTION:
The function encodes a sequence of bits into a sequence of characters.
Note:
* By default it converts a sequence of bits to 'base10', which is decimal.
PARAMETERS:
encoding:
Optional Argument.
Specifies encoding "from_byte" uses to encode the sequence of characters
specified by column.
The following encodings are supported:
* BaseX
* BaseY
* Base64M (MIME)
* ASCII
where X is a power of 2 (for example, 2, 8, 16) and
Y is not a power of 2 (for example, 10 and 36).
Default Value: 'base10'
Types: str
Returns:
ColumnExpression.
EXAMPLES:
# Load the data to run the example.
>>> load_example_data("dataframe", "bytes_table")
# Create a DataFrame on 'bytes_table' table.
>>> df = DataFrame("bytes_table")
>>> print(df)
byte_col varbyte_col blob_col
id_col
2 b'61' b'616263643132' b'6162636431323233'
1 b'62' b'62717765' b'3331363136323633'
0 b'63' b'627A7863' b'3330363136323633'
# Example 1: Converts values in "byte_col" to decimal and pass it as input to
# DataFrame.assign().
>>> decimal_df = df.assign(decimal_col = df.byte_col.from_byte())
>>> print(decimal_df)
byte_col varbyte_col blob_col decimal_col
id_col
2 b'61' b'627A7863' b'6162636431323233...' 97
1 b'62' b'616263643132' b'3331363136323633...' 98
0 b'63' b'62717765' b'3330363136323633...' 99
>>>