pyspark.sql.functions.bit_get¶
-
pyspark.sql.functions.bit_get(col: ColumnOrName, pos: ColumnOrName) → pyspark.sql.column.Column[source]¶ Returns the value of the bit (0 or 1) at the specified position. The positions are numbered from right to left, starting at zero. The position argument cannot be negative.
New in version 3.5.0.
- Parameters
- Returns
Columnthe value of the bit (0 or 1) at the specified position.
Examples
>>> df = spark.createDataFrame([[1],[1],[2]], ["c"]) >>> df.select(bit_get("c", lit(1))).show() +-------------+ |bit_get(c, 1)| +-------------+ | 0| | 0| | 1| +-------------+