Skip to content

Commit

Permalink
Merge branch 'main' into pixi
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Jun 22, 2024
2 parents 5be00f8 + 258f04a commit fef50df
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
5 changes: 4 additions & 1 deletion geoviews/data/geopandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,10 @@ def range(cls, dataset, dim):
return bounds.miny.min(), bounds.maxy.max()
else:
vals = dataset.data[dim.name]
return vals.min(), vals.max()
try:
return vals.min(), vals.max()
except TypeError:
return np.nan, np.nan

@classmethod
def aggregate(cls, columns, dimensions, function, **kwargs):
Expand Down
28 changes: 14 additions & 14 deletions geoviews/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions geoviews/tests/data/test_geopandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
except ImportError:
geopandas = None

from holoviews import render
from holoviews.core.data import Dataset
from holoviews.core.data.interface import DataError
from holoviews.element import Path, Points, Polygons
Expand Down Expand Up @@ -201,3 +202,15 @@ def test_geometry_column_not_named_geometry_and_additional_geometry_column(self)
ds = Dataset(gdf, kdims=['Longitude', 'Latitude'], datatype=[self.datatype])
self.assertEqual(ds.dimension_values('Longitude'), np.array([0, 1]))
self.assertEqual(ds.dimension_values('Latitude'), np.array([1, 2]))

def test_geopandas_dataframe_with_different_dtype_column(self):
# Fix for https://github.com/holoviz/geoviews/issues/721
df = pd.DataFrame(
{
"x": [1, 2, 3, 4, 5],
"y": [1, 2, 3, 4, 5],
"value": [5, '4', 3, 2, 1],
}
)
gdf = geopandas.GeoDataFrame(df, geometry=geopandas.points_from_xy(df.x, df.y))
render(Points(gdf))

0 comments on commit fef50df

Please sign in to comment.