byte_encoding

Teradata® Python Package User Guide

brand
Teradata Vantage
prodname
Teradata Python Package
vrm_release
16.20
category
User Guide
featnum
B700-4006-098K
The byte_encoding 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® Database SQL Functions, Operators, 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'