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

prepare_hotmaps_database tries to use non-existing column "index_right" #1124

Closed
fhg-isi opened this issue Jul 1, 2024 · 1 comment · Fixed by #1136
Closed

prepare_hotmaps_database tries to use non-existing column "index_right" #1124

fhg-isi opened this issue Jul 1, 2024 · 1 comment · Fixed by #1136
Labels

Comments

@fhg-isi
Copy link
Contributor

fhg-isi commented Jul 1, 2024

Describe the Bug

When trying to run the script build_industrial_distribution_key.py I get the error below.

The cause seems to be that the column "index_right" does not exist in gdf.

    gdf.rename(columns={"index_right": "bus"}, inplace=True)
    gdf["country"] = gdf.bus.str[:2]

Maybe the format of the hotmaps file changed?

=> Replace the line with

gdf["country"] = gdf["Country"] ?

Or just use existing column "Country"?

Error Message

(pypsa-eur) projekt-resilient03@ubuntu-22-04-lts-temp:~/pypsa-eur$ python scripts/build_industrial_distribution_key.py
ERROR:root:Uncaught exception
Traceback (most recent call last):
  File "/home/projekt-resilient03/pypsa-eur/scripts/build_industrial_distribution_key.py", line 189, in <module>
    hotmaps = prepare_hotmaps_database(regions)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/projekt-resilient03/pypsa-eur/scripts/build_industrial_distribution_key.py", line 120, in prepare_hotmaps_database
    gdf["country"] = gdf.bus.str[:2]
                     ^^^^^^^
  File "/home/projekt-resilient03/conda/envs/pypsa-eur/lib/python3.11/site-packages/pandas/core/generic.py", line 6299, in __getattr__
    return object.__getattribute__(self, name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'GeoDataFrame' object has no attribute 'bus'

Related:

#1118

#1123

@fhg-isi
Copy link
Contributor Author

fhg-isi commented Jul 1, 2024

Similar issue in build_gas_input_locations.py:

gas_input_nodes.rename(columns={"index_right": "bus"}, inplace=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant