Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns the parent H3 cell ID of the input H3 cell ID at the specified resolution. Supports Spark Connect.
For the corresponding Databricks SQL function, see h3_toparent function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.h3_toparent(col1=<col1>, col2=<col2>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col1 |
pyspark.sql.Column or str |
An H3 cell ID, represented as a BIGINT or a string |
col2 |
pyspark.sql.Column, str, or int |
The resolution of the parent H3 cell ID to return. Must be non-negative and smaller or equal to the resolution of the first argument. |
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(599686042433355775, 0,)], ['h3l', 'res'])
df.select(dbf.h3_toparent('h3l', 'res').alias('result')).collect()
[Row(result=577199624117288959)]
df.select(dbf.h3_toparent('h3l', 0).alias('result')).collect()
[Row(result=577199624117288959)]