pyspark.sql.functions.
bin
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.
Column
target column to work on.
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')]