We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Support for the spatialpandas.GeoDataFrame was added in #4120, but I don't think that PR included support for spatialpandas.DaskGeoDataFrame.
spatialpandas.GeoDataFrame
spatialpandas.DaskGeoDataFrame
I ran into this while working on updating https://examples.pyviz.org/osm/osm-1billion.html#osm-gallery-osm-1billion to use spatialpandas.
spatialpandas
Here's a minimal example:
import spatialpandas as sp import holoviews as hv import dask.dataframe as dd spdf = sp.GeoDataFrame({ 'geometry': sp.geometry.PointArray(([1, 2, 3], [3, 2, 1])) }) hv.Points(spdf, kdims=['x', 'y'])
Using a spatialpandas.DaskGeoDataFrame produces an odd plot with a single point.
spddf = dd.from_pandas(spdf, npartitions=1) hv.Points(spddf, kdims=['x', 'y'])
spatialpandas.DaskGeoDataFrame with Datashader fails (but it does work with GeoDataFrame)
GeoDataFrame
from holoviews.operation.datashader import datashade datashade(hv.Points(spddf, kdims=['x', 'y']))
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) ~/anaconda3/envs/datashader_dev_spatial/lib/python3.7/site-packages/IPython/core/formatters.py in __call__(self, obj, include, exclude) 968 969 if method is not None: --> 970 return method(include=include, exclude=exclude) 971 return None 972 else: ~/PyDev/repos/holoviews/holoviews/core/dimension.py in _repr_mimebundle_(self, include, exclude) 1305 combined and returned. 1306 """ -> 1307 return Store.render(self) 1308 1309 ~/PyDev/repos/holoviews/holoviews/core/options.py in render(cls, obj) 1386 data, metadata = {}, {} 1387 for hook in hooks: -> 1388 ret = hook(obj) 1389 if ret is None: 1390 continue ~/PyDev/repos/holoviews/holoviews/ipython/display_hooks.py in pprint_display(obj) 280 if not ip.display_formatter.formatters['text/plain'].pprint: 281 return None --> 282 return display(obj, raw_output=True) 283 284 ~/PyDev/repos/holoviews/holoviews/ipython/display_hooks.py in display(obj, raw_output, **kwargs) 256 elif isinstance(obj, (HoloMap, DynamicMap)): 257 with option_state(obj): --> 258 output = map_display(obj) 259 elif isinstance(obj, Plot): 260 output = render(obj) ~/PyDev/repos/holoviews/holoviews/ipython/display_hooks.py in wrapped(element) 144 try: 145 max_frames = OutputSettings.options['max_frames'] --> 146 mimebundle = fn(element, max_frames=max_frames) 147 if mimebundle is None: 148 return {}, {} ~/PyDev/repos/holoviews/holoviews/ipython/display_hooks.py in map_display(vmap, max_frames) 204 return None 205 --> 206 return render(vmap) 207 208 ~/PyDev/repos/holoviews/holoviews/ipython/display_hooks.py in render(obj, **kwargs) 66 renderer = renderer.instance(fig='png') 67 ---> 68 return renderer.components(obj, **kwargs) 69 70 ~/PyDev/repos/holoviews/holoviews/plotting/renderer.py in components(self, obj, fmt, comm, **kwargs) 361 doc = Document() 362 with config.set(embed=embed): --> 363 model = plot.layout._render_model(doc, comm) 364 return render_model(model, comm) if embed else render_mimebundle(model, doc, comm) 365 else: ~/anaconda3/envs/datashader_dev_spatial/lib/python3.7/site-packages/panel/viewable.py in _render_model(self, doc, comm) 355 if comm is None: 356 comm = state._comm_manager.get_server_comm() --> 357 model = self.get_root(doc, comm) 358 359 if config.embed: ~/anaconda3/envs/datashader_dev_spatial/lib/python3.7/site-packages/panel/viewable.py in get_root(self, doc, comm) 526 """ 527 doc = doc or _curdoc() --> 528 root = self._get_model(doc, comm=comm) 529 self._preprocess(root) 530 ref = root.ref['id'] ~/anaconda3/envs/datashader_dev_spatial/lib/python3.7/site-packages/panel/layout.py in _get_model(self, doc, root, parent, comm) 134 if root is None: 135 root = model --> 136 objects = self._get_objects(model, [], doc, root, comm) 137 props = dict(self._init_properties(), objects=objects) 138 model.update(**self._process_param_change(props)) ~/anaconda3/envs/datashader_dev_spatial/lib/python3.7/site-packages/panel/layout.py in _get_objects(self, model, old_objects, doc, root, comm) 124 else: 125 try: --> 126 child = pane._get_model(doc, root, model, comm) 127 except RerenderError: 128 return self._get_objects(model, current_objects[:i], doc, root, comm) ~/anaconda3/envs/datashader_dev_spatial/lib/python3.7/site-packages/panel/pane/holoviews.py in _get_model(self, doc, root, parent, comm) 225 plot = self.object 226 else: --> 227 plot = self._render(doc, comm, root) 228 229 plot.pane = self ~/anaconda3/envs/datashader_dev_spatial/lib/python3.7/site-packages/panel/pane/holoviews.py in _render(self, doc, comm, root) 284 kwargs = {} 285 --> 286 return renderer.get_plot(self.object, **kwargs) 287 288 def _cleanup(self, root): ~/PyDev/repos/holoviews/holoviews/plotting/bokeh/renderer.py in get_plot(self_or_cls, obj, doc, renderer, **kwargs) 70 combining the bokeh model with another plot. 71 """ ---> 72 plot = super(BokehRenderer, self_or_cls).get_plot(obj, doc, renderer, **kwargs) 73 if plot.document is None: 74 plot.document = Document() if self_or_cls.notebook_context else curdoc() ~/PyDev/repos/holoviews/holoviews/plotting/renderer.py in get_plot(self_or_cls, obj, doc, renderer, comm, **kwargs) 200 201 # Initialize DynamicMaps with first data item --> 202 initialize_dynamic(obj) 203 204 if not renderer: ~/PyDev/repos/holoviews/holoviews/plotting/util.py in initialize_dynamic(obj) 248 continue 249 if not len(dmap): --> 250 dmap[dmap._initial_key()] 251 252 ~/PyDev/repos/holoviews/holoviews/core/spaces.py in __getitem__(self, key) 1327 # Not a cross product and nothing cached so compute element. 1328 if cache is not None: return cache -> 1329 val = self._execute_callback(*tuple_key) 1330 if data_slice: 1331 val = self._dataslice(val, data_slice) ~/PyDev/repos/holoviews/holoviews/core/spaces.py in _execute_callback(self, *args) 1100 1101 with dynamicmap_memoization(self.callback, self.streams): -> 1102 retval = self.callback(*args, **kwargs) 1103 return self._style(retval) 1104 ~/PyDev/repos/holoviews/holoviews/core/spaces.py in __call__(self, *args, **kwargs) 734 735 try: --> 736 ret = self.callable(*args, **kwargs) 737 except KeyError: 738 # KeyError is caught separately because it is used to signal ~/PyDev/repos/holoviews/holoviews/util/__init__.py in dynamic_operation(*key, **kwargs) 971 def dynamic_operation(*key, **kwargs): 972 key, obj = resolve(key, kwargs) --> 973 return apply(obj, *key, **kwargs) 974 975 if isinstance(self.p.operation, Operation): ~/PyDev/repos/holoviews/holoviews/util/__init__.py in apply(element, *key, **kwargs) 967 def apply(element, *key, **kwargs): 968 kwargs = dict(util.resolve_dependent_kwargs(self.p.kwargs), **kwargs) --> 969 return self._process(element, key, kwargs) 970 971 def dynamic_operation(*key, **kwargs): ~/PyDev/repos/holoviews/holoviews/util/__init__.py in _process(self, element, key, kwargs) 949 elif isinstance(self.p.operation, Operation): 950 kwargs = {k: v for k, v in kwargs.items() if k in self.p.operation.param} --> 951 return self.p.operation.process_element(element, key, **kwargs) 952 else: 953 return self.p.operation(element, **kwargs) ~/PyDev/repos/holoviews/holoviews/core/operation.py in process_element(self, element, key, **params) 167 self.p = param.ParamOverrides(self, params, 168 allow_extra_keywords=self._allow_extra_keywords) --> 169 return self._apply(element, key) 170 171 ~/PyDev/repos/holoviews/holoviews/core/operation.py in _apply(self, element, key) 127 element_pipeline = getattr(element, '_pipeline', None) 128 --> 129 ret = self._process(element, key) 130 for hook in self._postprocess_hooks: 131 ret = hook(self, ret, **kwargs) ~/PyDev/repos/holoviews/holoviews/operation/datashader.py in _process(self, element, key) 1403 1404 def _process(self, element, key=None): -> 1405 agg = rasterize._process(self, element, key) 1406 shaded = shade._process(self, agg, key) 1407 return shaded ~/PyDev/repos/holoviews/holoviews/operation/datashader.py in _process(self, element, key) 1382 if k in transform.param}) 1383 op._precomputed = self._precomputed -> 1384 element = element.map(op, predicate) 1385 self._precomputed = op._precomputed 1386 ~/PyDev/repos/holoviews/holoviews/core/data/__init__.py in pipelined_fn(*args, **kwargs) 201 202 try: --> 203 result = method_fn(*args, **kwargs) 204 205 op = method_op.instance( ~/PyDev/repos/holoviews/holoviews/core/data/__init__.py in map(self, *args, **kwargs) 1048 1049 def map(self, *args, **kwargs): -> 1050 return super(Dataset, self).map(*args, **kwargs) 1051 map.__doc__ = LabelledData.map.__doc__ 1052 ~/PyDev/repos/holoviews/holoviews/core/dimension.py in map(self, map_fn, specs, clone) 707 return deep_mapped 708 else: --> 709 return map_fn(self) if applies else self 710 711 ~/PyDev/repos/holoviews/holoviews/core/operation.py in __call__(self, element, **kwargs) 186 for k, el in element.items()]) 187 elif isinstance(element, ViewableElement): --> 188 return self._apply(element) 189 elif 'streams' not in kwargs: 190 kwargs['streams'] = self.p.streams ~/PyDev/repos/holoviews/holoviews/core/operation.py in _apply(self, element, key) 127 element_pipeline = getattr(element, '_pipeline', None) 128 --> 129 ret = self._process(element, key) 130 for hook in self._postprocess_hooks: 131 ret = hook(self, ret, **kwargs) ~/PyDev/repos/holoviews/holoviews/operation/datashader.py in _process(self, element, key) 416 if self.p.precompute: 417 self._precomputed[element._plot_id] = x, y, data, glyph --> 418 (x_range, y_range), (xs, ys), (width, height), (xtype, ytype) = self._get_sampling(element, x, y) 419 ((x0, x1), (y0, y1)), (xs, ys) = self._dt_transform(x_range, y_range, xs, ys, xtype, ytype) 420 ~/PyDev/repos/holoviews/holoviews/operation/datashader.py in _get_sampling(self, element, x, y, ndim, default) 159 xstart, xend = dt_to_int(xstart, 'ns'), dt_to_int(xend, 'ns') 160 xtype = 'datetime' --> 161 elif not np.isfinite(xstart) and not np.isfinite(xend): 162 xstart, xend = 0, 0 163 if x and element.get_dimension_type(x[0]) in datetime_types: TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
The text was updated successfully, but these errors were encountered:
Strange indeed, will have to look into it.
Sorry, something went wrong.
No branches or pull requests
Support for the
spatialpandas.GeoDataFrame
was added in #4120, but I don't think that PR included support forspatialpandas.DaskGeoDataFrame
.I ran into this while working on updating https://examples.pyviz.org/osm/osm-1billion.html#osm-gallery-osm-1billion to use
spatialpandas
.Here's a minimal example:
spatialpandas.GeoDataFrame
Using a
spatialpandas.DaskGeoDataFrame
produces an odd plot with a single point.spatialpandas.DaskGeoDataFrame
with Datashader fails (but it does work withGeoDataFrame
)The text was updated successfully, but these errors were encountered: