prettymapp
prettymapp copied to clipboard
Index Issue
Hi,
I am quite new to python, and I am trying to create a python script in Visual Studio. But I am receiving the following error message. Is there a solution?
Many thanks
Blake
Hi @BlakeatFrasers not sure about this, seems to related to pandas / geopandas dataframe. Could you check your osmnx / pandas / geopandas installation? What happens if you print aoi & df variables?
Thanks for the quick reply @chrieke
osmnx seems to be causing the issue. This was fixed by re-installing the package. The version re-installed was 1.2.2, if this helps.
Cheers Blake
fresh installation:
Traceback (most recent call last):
File "/home/fmn/.data/workshop/prettymap/run.py", line 7, in <module>
df = get_osm_geometries(aoi=aoi)
File "/home/fmn/.data/workshop/prettymap/venv/lib/python3.10/site-packages/prettymapp/osm.py", line 22, in get_osm_geometries
df = df.droplevel(level=0)
File "/home/fmn/.data/workshop/prettymap/venv/lib/python3.10/site-packages/pandas/core/generic.py", line 919, in droplevel
new_labels = labels.droplevel(level)
File "/home/fmn/.data/workshop/prettymap/venv/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 2183, in droplevel
return self._drop_level_numbers(levnums)
File "/home/fmn/.data/workshop/prettymap/venv/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 2194, in _drop_level_numbers
raise ValueError(
ValueError: Cannot remove 1 levels from an index with 1 levels: at least one level must be left.