pyspark.sql.functions.shiftright#
- pyspark.sql.functions.shiftright(col, numBits)[source]#
- (Signed) shift the given value numBits right. - New in version 3.2.0. - Changed in version 3.4.0: Supports Spark Connect. - Parameters
- colColumnor column name
- input column of values to shift. 
- numBitsint
- number of bits to shift. 
 
- col
- Returns
- Column
- shifted values. 
 
 - Examples - >>> import pyspark.sql.functions as sf >>> spark.range(4).select("*", sf.shiftright('id', 1)).show() +---+-----------------+ | id|shiftright(id, 1)| +---+-----------------+ | 0| 0| | 1| 0| | 2| 1| | 3| 1| +---+-----------------+