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

BUG: UnboundLocalError when missing_kwds is used #2210

Closed
martinfleis opened this issue Nov 1, 2021 · 3 comments · Fixed by #2281
Closed

BUG: UnboundLocalError when missing_kwds is used #2210

martinfleis opened this issue Nov 1, 2021 · 3 comments · Fixed by #2281

Comments

@martinfleis
Copy link
Member

I'm afraid the issue isn't completely solved yet. Still (0.9.0, 0.10.2) getting the following error

Bildschirmfoto 2021-11-01 um 18 21 00

however, if I apply your fix a second time a little later in the code like this

Bildschirmfoto 2021-11-01 um 18 21 58

it plots as expected – should you need a testcase pls let me know and thanks so far

Originally posted by @wahlatlas in #1600 (comment)

@wahlatlas
Copy link

wahlatlas commented Nov 1, 2021

Would this be of any help as a testcase
https://nbviewer.org/urls/wahlatlas.net/btw/21/geopandas.ipynb
or would you need a more reduced case with english comments?

Bildschirmfoto 2021-11-01 um 20 17 01

@wahlatlas
Copy link

Maybe some complete sentence on the issue:
The missing_kwds defines how missing data should be styled on the plotted map and does this just fine. However if such definition is present but there happens to be no missing data, the mentioned UnboundLocalError will occur. In the above example this comes up as the plot command is used with various data columns, some of which happen to have missing data, others not (in this case smaller parties that weren't eligible in the whole country).

@jdmcbr
Copy link
Member

jdmcbr commented Jan 3, 2022

A reproducible example:

import geopandas as gpd
world = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres"))
world.plot(column="continent", legend=True, missing_kwds={"facecolor": "none"})

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

Successfully merging a pull request may close this issue.

3 participants