-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Encountered a rather puzzling bug where a non-sequential index for a dataframe causes a problem when converting cells to geodataframe resulting in missing geometry for most of the cells.
uvx --with h3ronpy[pandas] python
from h3ronpy.pandas.vector import cells_dataframe_to_geodataframe
import pandas as pd
df = pd.DataFrame({'cell': {2: 630950036828342783, 19: 630950036828350975, 38: 630950036828390911, 55: 630950036828391423}})
cells_dataframe_to_geodataframe(df) cell geometry
2 630950036828342783 POLYGON ((-3.42058 50.63746, -3.42072 50.63743...
19 630950036828350975 None
38 630950036828390911 None
55 630950036828391423 None
Resetting the index is a workaround for the issue
cells_dataframe_to_geodataframe(df.reset_index(drop=True))0 630950036828342783 POLYGON ((-3.41817 50.6377, -3.41831 50.63767,...
1 630950036828350975 POLYGON ((-3.41884 50.63765, -3.41898 50.63762...
2 630950036828390911 POLYGON ((-3.42058 50.63746, -3.42072 50.63743...
3 630950036828391423 POLYGON ((-3.42048 50.6373, -3.42062 50.63727,...
Metadata
Metadata
Assignees
Labels
No labels