Teradata Package for Python Function Reference | 20.00 - rotateleft - 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.rotateleft = rotateleft(bit_mask)
DESCRIPTION:
    Function returns an expression rotated to the left by the specified number of bits,
    with the most significant bits wrapping around to the right.
 
PARAMETERS:
    bit_mask:
        Required Argument.
        Specifies a ColumnExpression of an integer column or an integer literal
        indicating the number of bit positions to rotate.
        Notes:
        1. If "bit_mask" is equal to zero, then the function returns value in column
           unchanged.
        2. If "bit_mask" is negative, then the function rotates the bits to the right
           instead of the left.
        3. If value in column and/or "bit_mask" are NULL, then the function returns NULL.
        4. If "bit_mask" is larger than the size of value in column, then the function rotates
           ("bit_mask" MOD sizeof(value in column)) bits. The scope of the rotation operation
           is bounded by the size of the bit value in column.
        Format of a ColumnExpression of a column: '<dataframe>.<dataframe_column>'.
        Types: ColumnExpression, int
 
RAISES:
    TypeError, ValueError, TeradataMlException
 
RETURNS:
    DataFrameColumn
 
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'
 
    # Example1: Rotates values in "varbyte_col" column to left by 3 bits and
    #           pass it as input to DataFrame.assign().
    >>> res_df = df.assign(col= df.varbyte_col.rotateleft(3))
    >>> print(res_df)
           byte_col      varbyte_col             blob_col             col
    id_col
    2         b'61'  b'616263643132'  b'6162636431323233'  b'B131B218993'
    1         b'62'      b'62717765'  b'3331363136323633'     b'138BBB2B'
    0         b'63'      b'627A7863'  b'3330363136323633'     b'13D3C31B'