pyspark.sql.functions.bitmap_count#
- pyspark.sql.functions.bitmap_count(col)[source]#
Returns the number of set bits in the input bitmap.
New in version 3.5.0.
- Parameters
- col
Column
or str The input bitmap.
- col
Examples
>>> df = spark.createDataFrame([("FFFF",)], ["a"]) >>> df.select(bitmap_count(to_binary(df.a, lit("hex"))).alias('r')).collect() [Row(r=16)]