prettymapp icon indicating copy to clipboard operation
prettymapp copied to clipboard

Index Issue

Open BlakeatFrasers opened this issue 2 years ago • 1 comments

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 image

BlakeatFrasers avatar Aug 10 '22 15:08 BlakeatFrasers

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?

chrieke avatar Aug 10 '22 19:08 chrieke

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

BlakeatFrasers avatar Aug 11 '22 09:08 BlakeatFrasers

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.

filipmnowak avatar Aug 22 '23 19:08 filipmnowak