Kopīgot, izmantojot


bin

Returns the string representation of the binary value of the given column. Supports Spark Connect.

For the corresponding Databricks SQL function, see bin function.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.bin(col=<col>)

Parameters

Parameter Type Description
col pyspark.sql.Column or str Target column to work on.

Returns

pyspark.sql.Column: binary representation of given value as string.

Examples

from pyspark.databricks.sql import functions as dbf
spark.range(10).select("*", dbf.bin("id")).show()
+---+-------+
| id|bin(id)|
+---+-------+
|  0|      0|
|  1|      1|
|  2|     10|
|  3|     11|
|  4|    100|
|  5|    101|
|  6|    110|
|  7|    111|
|  8|   1000|
|  9|   1001|
+---+-------+