pyspark.sql.functions.shiftleft¶
-
pyspark.sql.functions.
shiftleft
(col: ColumnOrName, numBits: int) → pyspark.sql.column.Column[source]¶ Shift the given value numBits left.
New in version 3.2.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- col
Column
or str input column of values to shift.
- numBitsint
number of bits to shift.
- col
- Returns
Column
shifted value.
Examples
>>> spark.createDataFrame([(21,)], ['a']).select(shiftleft('a', 1).alias('r')).collect() [Row(r=42)]