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

Fix geopandas type check #1367

Merged
merged 2 commits into from
Jul 16, 2024
Merged

Fix geopandas type check #1367

merged 2 commits into from
Jul 16, 2024

Conversation

ahuang11
Copy link
Collaborator

@ahuang11 ahuang11 commented Jul 9, 2024

If geometry is None, it crashes:

import hvplot.pandas
import censusdis.data as ced
from censusdis.datasets import ACS5
from censusdis.counties.washington import KING
from censusdis.states import WA

GROUP = "B25008"

gdf_king = ced.download(
    ACS5,
    2020,
    # Instead of listing the variables, we can ask for a whole group.
    group=GROUP,
    state=WA,
    county=KING,
    tract="*",
    with_geometry=True,
    # An optional flag that produces better maps in coastal areas.
    # More on this in the next lesson.
    remove_water=True,
)
gdf_king

If geometry is None, it crashes:
```python
import hvplot.pandas
import censusdis.data as ced
from censusdis.datasets import ACS5
from censusdis.counties.washington import KING
from censusdis.states import WA

GROUP = "B25008"

gdf_king = ced.download(
    ACS5,
    2020,
    # Instead of listing the variables, we can ask for a whole group.
    group=GROUP,
    state=WA,
    county=KING,
    tract="*",
    with_geometry=True,
    # An optional flag that produces better maps in coastal areas.
    # More on this in the next lesson.
    remove_water=True,
)
gdf_king
```
Copy link

codecov bot commented Jul 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.41%. Comparing base (6c96c7e) to head (79a13dd).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1367      +/-   ##
==========================================
+ Coverage   87.39%   88.41%   +1.02%     
==========================================
  Files          50       50              
  Lines        7490     7366     -124     
==========================================
- Hits         6546     6513      -33     
+ Misses        944      853      -91     

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

Copy link
Member

@maximlt maximlt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A test would be much appreciated.

@ahuang11 ahuang11 requested a review from maximlt July 11, 2024 16:33
Copy link
Member

@maximlt maximlt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In itself the change looks good to me. I'd be curious to know how geopandas' .plot behaves in the same situation.

@maximlt maximlt merged commit 51a03c8 into main Jul 16, 2024
9 checks passed
@maximlt maximlt deleted the fix-geom-type-check branch July 16, 2024 14:21
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 this pull request may close these issues.

2 participants