You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an issue with drivers like GPKG which have feature indexes that start with 1 (and not 0). For example poly.gpkg with 10 features:
importfionads=fiona.open("poly.gpkg")
assertds[0] isNoneprint(ds[1]["id"]) # 1 <- the firstprint(ds[10]["id"]) # 10 <- the lastprint(ds[-1]["id"]) # 9 <- whoops!
with a -1 getitem index, it is usually expected to get the last item, but instead the second last item is returned.
Some ideas for the next development cycle is to deprecate negative indices for getitem, since they are not always zero-indexed, and introduce something like iloc (or irec?) similar to pandas to always retrieve the zero-indexed records.
The text was updated successfully, but these errors were encountered:
This is an issue with drivers like GPKG which have feature indexes that start with 1 (and not 0). For example poly.gpkg with 10 features:
with a -1 getitem index, it is usually expected to get the last item, but instead the second last item is returned.
Some ideas for the next development cycle is to deprecate negative indices for getitem, since they are not always zero-indexed, and introduce something like
iloc
(orirec
?) similar to pandas to always retrieve the zero-indexed records.The text was updated successfully, but these errors were encountered: