pyspark.sql.functions.bin¶
-
pyspark.sql.functions.
bin
(col: ColumnOrName) → pyspark.sql.column.Column[source]¶ Returns the string representation of the binary value of the given column.
New in version 1.5.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- col
Column
or str target column to work on.
- col
- Returns
Column
binary representation of given value as string.
Examples
>>> df = spark.createDataFrame([2,5], "INT") >>> df.select(bin(df.value).alias('c')).collect() [Row(c='10'), Row(c='101')]