You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I have a workflow in which I process a geopandas GeoDataFrame in order to draw a map on a dashboard. At some point, I wish to make use of datashader reduction capabilities and thus, I convert my df into a spatialpandas GeoDataFrame. My dashboard allows to set filters which can lead my GeoDataFrame to be empty, and in that case, the conversion into a spatialpandas GeoDataFrame fails:
ValueError: A spatialpandas GeoDataFrame must contain at least one spatialpandas GeometryArray column
This led me to realize that spatialpandas does not allow the instanciation of an empty DataFrame, or at least not in the way pandas and geopandas allow it:
I would like to be able to generate empty spatialpandas GeoDataFrame.
Describe alternatives you've considered
An alternative I have is to first convert into a spatialpandas GeoDataFrame, and then filter this new DataFrame. When I do it in this order, query() is able to return an empty spatialpandas GeoDataFrame if there are indeed no matching results.
The text was updated successfully, but these errors were encountered:
rderollepot
changed the title
Being able to instanciate empty (Geo)DataFrame
Being able to instanciate empty GeoDataFrame
Jun 19, 2023
This should be fairly easy to implement, the question is whether it will break anything because of the previously valid assumption that a GeoDataFrame always contains data. I'll take a look.
Is your feature request related to a problem? Please describe.
I have a workflow in which I process a
geopandas
GeoDataFrame in order to draw a map on a dashboard. At some point, I wish to make use ofdatashader
reduction capabilities and thus, I convert mydf
into aspatialpandas
GeoDataFrame. My dashboard allows to set filters which can lead my GeoDataFrame to be empty, and in that case, the conversion into aspatialpandas
GeoDataFrame fails:ValueError: A spatialpandas GeoDataFrame must contain at least one spatialpandas GeometryArray column
This led me to realize that
spatialpandas
does not allow the instanciation of an empty DataFrame, or at least not in the waypandas
andgeopandas
allow it:Describe the solution you'd like
I would like to be able to generate empty
spatialpandas
GeoDataFrame.Describe alternatives you've considered
An alternative I have is to first convert into a
spatialpandas
GeoDataFrame, and then filter this new DataFrame. When I do it in this order,query()
is able to return an emptyspatialpandas
GeoDataFrame if there are indeed no matching results.The text was updated successfully, but these errors were encountered: