Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H3fy concats pandas dataframes for each polygon in source_unary #163

Closed
jtmiclat opened this issue Jul 5, 2022 · 1 comment
Closed

H3fy concats pandas dataframes for each polygon in source_unary #163

jtmiclat opened this issue Jul 5, 2022 · 1 comment

Comments

@jtmiclat
Copy link

jtmiclat commented Jul 5, 2022

Hi was looking h3fy implementation and I found the following lines

tobler/tobler/util/util.py

Lines 97 to 102 in 66f3825

output = []
for geom in source_unary.geoms:
hexes = _to_hex(geom, resolution=resolution, return_geoms=return_geoms)
output.append(hexes)
hexagons = pandas.concat(output)

It runs pd.concat for each polygon in source_unary. It should probably run pd.concat only once and outside the for loop like

        output = []
        for geom in source_unary.geoms:
            hexes = _to_hex(geom, resolution=resolution, return_geoms=return_geoms)
            output.append(hexes)
        hexagons = pandas.concat(output) # unindent
@jtmiclat jtmiclat changed the title H3fy creaties a pandas dataframe for each polygon in source_unary H3fy creates a pandas dataframe for each polygon in source_unary Jul 5, 2022
@jtmiclat jtmiclat changed the title H3fy creates a pandas dataframe for each polygon in source_unary H3fy concats pandas dataframes for each polygon in source_unary Jul 5, 2022
@knaaptime
Copy link
Member

good catch, thanks!

@knaaptime knaaptime mentioned this issue Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants