DahnJ
H3-Pandas
Jupyter Notebook

Integration of H3 with GeoPandas and Pandas

Last updated Jun 23, 2026
224
Stars
20
Forks
13
Issues
0
Stars/day
Attention Score
52
Language breakdown
Jupyter Notebook 99.1%
Python 0.9%
Shell 0.0%
Makefile 0.0%
Files click to expand
README

H3 Logo

 

H3-Pandas ⬢ 🐼

Integrates H3 with GeoPandas and Pandas. image Binder image Documentation Status

 


Try it out


example usage

Installation

pip

image
pip install h3pandas

conda

[conda-version]() Anaconda-Server Badge
conda install -c conda-forge h3pandas

Usage examples

H3 API

h3pandas automatically applies H3 functions to both Pandas Dataframes and GeoPandas Geodataframes
# Prepare data
>>> import pandas as pd
>>> import h3pandas
>>> df = pd.DataFrame({'lat': [50, 51], 'lng': [14, 15]})
>>> resolution = 10
>>> df = df.h3.geotoh3(resolution)
>>> df

| h3_10 | lat | lng | |:----------------|------:|------:| | 8a1e30973807fff | 50 | 14 | | 8a1e2659c2c7fff | 51 | 15 |

>>> df = df.h3.h3togeo_boundary() >>> df

| h3_10 | lat | lng | geometry | |:----------------|------:|------:|:----------------| | 8a1e30973807fff | 50 | 14 | POLYGON ((...)) | | 8a1e2659c2c7fff | 51 | 15 | POLYGON ((...)) |

H3-Pandas Extended API

h3pandas also provides some extended functionality out-of-the-box, often simplifying common workflows into a single command.
# Set up data
>>> import numpy as np
>>> import pandas as pd
>>> np.random.seed(1729)
>>> df = pd.DataFrame({
>>>   'lat': np.random.uniform(50, 51, 100),
>>>   'lng': np.random.uniform(14, 15, 100),
>>>   'value': np.random.poisson(100, 100)})
>>> })
# Aggregate values by their location and sum
>>> df = df.h3.geotoh3_aggregate(3)
>>> df

| h3_03 | value | geometry | |:----------------|--------:|:----------------| | 831e30fffffffff | 102 | POLYGON ((...)) | | 831e34fffffffff | 189 | POLYGON ((...)) | | 831e35fffffffff | 8744 | POLYGON ((...)) | | 831f1bfffffffff | 1040 | POLYGON ((...)) |

Aggregate to a lower H3 resolution

>>> df.h3.h3toparent_aggregate(2)

| h3_02 | value | geometry | |:----------------|--------:|:----------------| | 821e37fffffffff | 9035 | POLYGON ((...)) | | 821f1ffffffffff | 1040 | POLYGON ((...)) |

Further examples

For more examples, see the example notebooks.

API

For a full API documentation and more usage examples, see the documentation.

Development

H3-Pandas cover the basics of the H3 API, but there are still many possible improvements.

Any suggestions and contributions are very welcome!

In particular, the next steps are:

  • [ ] Improvements & stability of the "Extended API", e.g. kringsmoothing.
Additional possible directions See issues for more.

🔗 More in this category

© 2026 GitRepoTrend · DahnJ/H3-Pandas · Updated daily from GitHub