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

Improve pd.NA support with inspect_polygon #6362

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Improve pd.NA support with inspect_polygon #6362

wants to merge 3 commits into from

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Aug 17, 2024

I'm not the biggest fan of this solution...

Fixes part of the problem observed in #6308 (comment)

import geopandas as gpd
import holoviews as hv
import pandas as pd
import spatialpandas as spd
from holoviews.operation.datashader import datashade, inspect_polygons
from shapely.geometry import MultiPolygon, Polygon

hv.extension("bokeh")

square1 = Polygon([(0, 0), (0, 1), (1, 1), (1, 0)])
square2 = Polygon([(2, 0), (2, 1), (3, 1), (3, 0)])
gdf = gpd.GeoDataFrame({"geometry": [square1, square2], "name": [pd.NA, "B"]})
sdf = spd.GeoDataFrame(gdf)

polys = hv.Polygons(sdf)
shaded = datashade(polys)
hover = inspect_polygons(shaded).opts(fill_color="red", tools=["hover"])
(shaded * hover)

@hoxbro hoxbro added the type: bug Something isn't correct or isn't working label Aug 17, 2024
Copy link

codecov bot commented Aug 17, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88.50%. Comparing base (90f56c8) to head (a17de53).

Files with missing lines Patch % Lines
holoviews/core/data/spatialpandas.py 66.66% 1 Missing ⚠️
holoviews/core/util.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6362      +/-   ##
==========================================
- Coverage   88.50%   88.50%   -0.01%     
==========================================
  Files         323      323              
  Lines       68359    68363       +4     
==========================================
+ Hits        60502    60504       +2     
- Misses       7857     7859       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant