byte_encoding | Display Options | Teradata Python Package - byte_encoding - Teradata Package for Python

Teradata® Package for Python User Guide

Product
Teradata Package for Python
Release Number
17.00
Published
November 2021
Language
English (United States)
Last Update
2022-01-14
dita:mapPath
bol1585763678431.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
B700-4006
lifecycle
previous
Product Category
Teradata Vantage
The byte_encoding option controls the encoding used for printing byte-like types in a DataFrame. The default is Base16. The following encodings are supported:
  • BaseX

    X is a power of 2 (for example, 2, 8, 16).

  • BaseY

    Y is not a power of 2 (for example, 10 and 36).

  • Base64M (MIME)
  • ASCII
The from_bytes function is used to display byte-like types. See Teradata Vantage™ - SQL Functions, Expressions, and Predicates for more information on specifying arguments for FROM_BYTES.

Example: Default is Base16

>>> display.byte_encoding
'base16'
 
 
>>> DataFrame('byte')
 
 
           byte      varbyte         blob
id                                      
2   b'32616263'  b'32616263'  b'32616263'
1   b'31616263'  b'31616263'  b'31616263'
0   b'30616263'  b'30616263'  b'30616263'

Example: Set the value to ascii

>>> display.byte_encoding = 'ascii'
>>> DataFrame('byte')
 
 
       byte  varbyte     blob
id                          
2   b'2abc'  b'2abc'  b'2abc'
1   b'1abc'  b'1abc'  b'1abc'
0   b'0abc'  b'0abc'  b'0abc'