dtoolkit.geoaccessor.series.H3.to_parent#

H3.to_parent(resolution: int = None) Series[source]#

Get the parent of cell.

Parameters:
resolutionint, optional

The resolution for the children. If None, then use the current resolution of cell -1 .

Returns:
Series

With new H3 parent cell.

Examples

>>> import dtoolkit.geoaccessor
>>> import pandas as pd

Series Example.

>>> s = pd.Series(['a', 'b'], index=[612845052823076863, 614269156845420543])
>>> s
612845052823076863    a
614269156845420543    b
dtype: object
>>> s.h3.to_parent()
608341453197803519    a
609765557230632959    b
dtype: object

DataFrame Example.

>>> df = pd.DataFrame(
...     {'label': ['a', 'b']},
...     index=[612845052823076863, 614269156845420543],
... )
>>> df
                   label
612845052823076863     a
614269156845420543     b
>>> df.h3.to_parent()
                   label
608341453197803519     a
609765557230632959     b