Skip to content

Commit efa450e

Browse files
authored
Merge pull request #13 from DahnJ/feature/dj-general-upkeep
Feature/dj general upkeep
2 parents f3f80de + 0b0ff01 commit efa450e

9 files changed

+89
-36
lines changed

.codespellrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[codespell]
2+
skip = *.ipynb

.pre-commit-config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ repos:
1010
hooks:
1111
- id: flake8
1212
language_version: python3
13+
14+
- repo: https://github.com/codespell-project/codespell
15+
rev: v1.16.0
16+
hooks:
17+
- id: codespell
18+
language_version: python3

README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ and [Pandas](https://github.com/pandas-dev/pandas).
2929
## Installation
3030
### pip
3131
[![image](https://img.shields.io/pypi/v/h3pandas.svg)](https://pypi.python.org/pypi/h3pandas)
32-
[![image](https://pepy.tech/badge/h3pandas)](https://pepy.tech/project/h3pandas)
3332
```bash
3433
pip install h3pandas
3534
```
@@ -119,13 +118,16 @@ For a full API documentation and more usage examples, see the
119118
[documentation](https://h3-pandas.readthedocs.io/en/latest/).
120119

121120
## Development
122-
This package is under active development, **suggestions and contributions are very welcome**!
121+
H3-Pandas cover the basics of the H3 API, but there are still many possible improvements.
122+
123+
**Any suggestions and contributions are very welcome**!
123124

124125
In particular, the next steps are:
125-
- [ ] Improve documentation, examples
126-
- [ ] Greater coverage of the H3 API
126+
- [ ] Improvements & stability of the "Extended API", e.g. `k_ring_smoothing`.
127127

128128
Additional possible directions
129129
- [ ] Allow for alternate h3-py APIs such as [memview_int](https://github.com/uber/h3-py#h3apimemview_int)
130130
- [ ] Performance improvements through [Cythonized h3-py](https://github.com/uber/h3-py/pull/147)
131-
- [ ] [Dask](https://github.com/dask/dask) integration trough [dask-geopandas](https://github.com/geopandas/dask-geopandas) (experimental as of now)
131+
- [ ] [Dask](https://github.com/dask/dask) integration through [dask-geopandas](https://github.com/geopandas/dask-geopandas) (experimental as of now)
132+
133+
See [issues](https://github.com/DahnJ/H3-Pandas/issues) for more.

docs/source/notebook/00-intro.ipynb

+10-3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@
9898
"We can use `geo_to_h3` to add an index with H3 addresses resolution 10"
9999
]
100100
},
101+
{
102+
"cell_type": "markdown",
103+
"metadata": {},
104+
"source": [
105+
"`geo_to_h3` assumes coordinates are in `epsg=4326`"
106+
]
107+
},
101108
{
102109
"cell_type": "markdown",
103110
"metadata": {},
@@ -247,7 +254,7 @@
247254
"cell_type": "markdown",
248255
"metadata": {},
249256
"source": [
250-
"For now, we will pretend H3-Pandas do not have [aggregation functions](#Aggregation-functions) and perform the aggregations manually"
257+
"For now, we will pretend H3-Pandas does not have [aggregation functions](#Aggregation-functions) and perform the aggregations manually"
251258
]
252259
},
253260
{
@@ -649,7 +656,7 @@
649656
"cell_type": "markdown",
650657
"metadata": {},
651658
"source": [
652-
"## Aggregation functions: The same workflow, streamlined"
659+
"## H3-Pandas Extended API: The same workflow, streamlined"
653660
]
654661
},
655662
{
@@ -705,7 +712,7 @@
705712
],
706713
"metadata": {
707714
"kernelspec": {
708-
"display_name": "Python 3",
715+
"display_name": "Python 3 (ipykernel)",
709716
"language": "python",
710717
"name": "python3"
711718
},

docs/source/notebook/01-unified-data-layers.ipynb

+48-21
Large diffs are not rendered by default.

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
- python=3.9
77
- shapely
88
- h3-py=3.7.*
9-
- geopandas=0.9.*
9+
- geopandas>=0.9.*
1010
- pandas
1111
# For Python <3.8
1212
# - typing_extensions

h3pandas/h3pandas.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ def geo_to_h3(
4444
pd.DataFrame: uses `lat_col` and `lng_col` (default `lat` and `lng`)
4545
gpd.GeoDataFrame: uses `geometry`
4646
47+
Assumes coordinates in epsg=4326.
48+
4749
Parameters
4850
----------
4951
resolution : int
@@ -255,7 +257,7 @@ def k_ring(self, k: int = 1, explode: bool = False) -> AnyDataFrame:
255257
func = wrapped_partial(h3.k_ring, k=k)
256258
column_name = "h3_k_ring"
257259
if explode:
258-
return self.__apply_index_explode(func, column_name, list)
260+
return self._apply_index_explode(func, column_name, list)
259261
return self._apply_index_assign(func, column_name, list)
260262

261263
@doc_standard(
@@ -300,7 +302,7 @@ def hex_ring(self, k: int = 1, explode: bool = False) -> AnyDataFrame:
300302
func = wrapped_partial(h3.hex_ring, k=k)
301303
column_name = "h3_hex_ring"
302304
if explode:
303-
return self.__apply_index_explode(func, column_name, list)
305+
return self._apply_index_explode(func, column_name, list)
304306
return self._apply_index_assign(func, column_name, list)
305307

306308
@doc_standard("h3_{resolution}", "containing the parent of each H3 address")
@@ -668,7 +670,7 @@ def k_ring_smoothing(
668670

669671
# Unweighted case
670672
if weights is None:
671-
result = (
673+
result = pd.DataFrame(
672674
self._df.h3.k_ring(k, explode=True)
673675
.groupby("h3_k_ring")
674676
.sum()
@@ -788,7 +790,7 @@ def _apply_index_assign(
788790
assign_args = {column_name: result}
789791
return finalizer(self._df.assign(**assign_args))
790792

791-
def __apply_index_explode(
793+
def _apply_index_explode(
792794
self,
793795
func: Callable,
794796
column_name: str,

notebook/00-intro.ipynb

+8-1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@
9898
"We can use `geo_to_h3` to add an index with H3 addresses resolution 10"
9999
]
100100
},
101+
{
102+
"cell_type": "markdown",
103+
"metadata": {},
104+
"source": [
105+
"`geo_to_h3` assumes coordinates are in `epsg=4326`"
106+
]
107+
},
101108
{
102109
"cell_type": "markdown",
103110
"metadata": {},
@@ -705,7 +712,7 @@
705712
],
706713
"metadata": {
707714
"kernelspec": {
708-
"display_name": "Python 3",
715+
"display_name": "Python 3 (ipykernel)",
709716
"language": "python",
710717
"name": "python3"
711718
},

notebook/01-unified-data-layers.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@
714714
],
715715
"metadata": {
716716
"kernelspec": {
717-
"display_name": "Python 3",
717+
"display_name": "Python 3 (ipykernel)",
718718
"language": "python",
719719
"name": "python3"
720720
},

0 commit comments

Comments
 (0)