Skip to content

Commit

Permalink
Comment cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ndemaio committed Oct 26, 2023
1 parent 0049b17 commit e2809b8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions raster2dggs/rHPpandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pandas as pd
import geopandas as gpd

import raster2dggs.rhealpixdggs_py.rhealpixdggs.wrappers as rhp_py
import raster2dggs.rhealpixdggs_py.rhealpixdggs.rhp_wrappers as rhp_py

AnyDataFrame = Union[pd.DataFrame, gpd.GeoDataFrame]

Expand All @@ -22,6 +22,12 @@ def wrapped_partial(func, *args, **kwargs):

@pd.api.extensions.register_dataframe_accessor("rHP")
class rHPAccessor:
"""
Shamelessly appropriated from equivalent class in h3pandas package
WIP: adapt more functions as needed
"""

def __init__(self, df: pd.DataFrame) -> None:
self._df = df

Expand Down Expand Up @@ -87,9 +93,7 @@ def _apply_index_assign(
processor: Callable = lambda x: x,
finalizer: Callable = lambda x: x,
) -> Any:
"""
Appropriated from h3pandas package
"""
result = [processor(func(rhpaddress)) for rhpaddress in self._df.index]
assign_args = {column_name: result}

return finalizer(self._df.assign(**assign_args))

0 comments on commit e2809b8

Please sign in to comment.