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
It worked if I installed spatialpandas at version 0.4.2 and additionally installed holoviews and geopandas.
As an aside, I was running this because I have not been able to get my own code running using the example code I've found, but seems easier to use this as the bug report. My bug in other code is the same as in this notebook with the newest version of spatialpandas at this cell:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in
/srv/conda/envs/notebook/lib/python3.7/site-packages/datashader/utils.py in dshape_from_pandas(df)
441 """Return a datashape.DataShape object given a pandas dataframe."""
442 return len(df) * datashape.Record([(k, dshape_from_pandas_helper(df[k]))
--> 443 for k in df.columns])
444
445
/srv/conda/envs/notebook/lib/python3.7/site-packages/datashader/utils.py in (.0)
441 """Return a datashape.DataShape object given a pandas dataframe."""
442 return len(df) * datashape.Record([(k, dshape_from_pandas_helper(df[k]))
--> 443 for k in df.columns])
444
445
/srv/conda/envs/notebook/lib/python3.7/site-packages/datashader/utils.py in dshape_from_pandas_helper(col)
431 elif isinstance(col.dtype, (RaggedDtype, GeometryDtype)):
432 return col.dtype
--> 433 dshape = datashape.CType.from_numpy_dtype(col.dtype)
434 dshape = datashape.string if dshape == datashape.object_ else dshape
435 if dshape in (datashape.string, datashape.datetime_):
/srv/conda/envs/notebook/lib/python3.7/site-packages/datashape/coretypes.py in from_numpy_dtype(self, dt)
777 except KeyError:
778 pass
--> 779 if np.issubdtype(dt, np.datetime64):
780 unit, _ = np.datetime_data(dt)
781 defaults = {'D': date_, 'Y': date_, 'M': date_, 'W': date_}
/srv/conda/envs/notebook/lib/python3.7/site-packages/numpy/core/numerictypes.py in issubdtype(arg1, arg2)
416 """
417 if not issubclass_(arg1, generic):
--> 418 arg1 = dtype(arg1).type
419 if not issubclass_(arg2, generic):
420 arg2 = dtype(arg2).type
TypeError: Cannot interpret 'MultiPolygonDtype(float64)' as a data type
The text was updated successfully, but these errors were encountered:
Datashader recently removed spatialpandas as a compulsory dependency, but left places in the code which assumed it was always available. This has been fixed this week (#1116).
If I run the User Guide polygon code using the latest Datashader master branch it runs OK, so it looks like we have fixed this problem. There should be a new 0.14.3 release shortly.
I tried to run the Polygons docs page with binder and it doesn't run through: https://datashader.org/user_guide/Polygons.html
It worked if I installed
spatialpandas
at version0.4.2
and additionally installedholoviews
andgeopandas
.As an aside, I was running this because I have not been able to get my own code running using the example code I've found, but seems easier to use this as the bug report. My bug in other code is the same as in this notebook with the newest version of
spatialpandas
at this cell:/srv/conda/envs/notebook/lib/python3.7/site-packages/datashader/core.py in polygons(self, source, geometry, agg)
750 agg = any_rdn()
751 glyph = PolygonGeom(geometry)
--> 752 return bypixel(source, self, glyph, agg)
753
754 def quadmesh(self, source, x=None, y=None, agg=None):
/srv/conda/envs/notebook/lib/python3.7/site-packages/datashader/core.py in bypixel(source, canvas, glyph, agg)
1263 if len(cols_to_keep) < len(source.columns):
1264 source = source[cols_to_keep]
-> 1265 dshape = dshape_from_pandas(source)
1266 elif isinstance(source, dd.DataFrame):
1267 dshape = dshape_from_dask(source)
/srv/conda/envs/notebook/lib/python3.7/site-packages/datashader/utils.py in dshape_from_pandas(df)
441 """Return a datashape.DataShape object given a pandas dataframe."""
442 return len(df) * datashape.Record([(k, dshape_from_pandas_helper(df[k]))
--> 443 for k in df.columns])
444
445
/srv/conda/envs/notebook/lib/python3.7/site-packages/datashader/utils.py in (.0)
441 """Return a datashape.DataShape object given a pandas dataframe."""
442 return len(df) * datashape.Record([(k, dshape_from_pandas_helper(df[k]))
--> 443 for k in df.columns])
444
445
/srv/conda/envs/notebook/lib/python3.7/site-packages/datashader/utils.py in dshape_from_pandas_helper(col)
431 elif isinstance(col.dtype, (RaggedDtype, GeometryDtype)):
432 return col.dtype
--> 433 dshape = datashape.CType.from_numpy_dtype(col.dtype)
434 dshape = datashape.string if dshape == datashape.object_ else dshape
435 if dshape in (datashape.string, datashape.datetime_):
/srv/conda/envs/notebook/lib/python3.7/site-packages/datashape/coretypes.py in from_numpy_dtype(self, dt)
777 except KeyError:
778 pass
--> 779 if np.issubdtype(dt, np.datetime64):
780 unit, _ = np.datetime_data(dt)
781 defaults = {'D': date_, 'Y': date_, 'M': date_, 'W': date_}
/srv/conda/envs/notebook/lib/python3.7/site-packages/numpy/core/numerictypes.py in issubdtype(arg1, arg2)
416 """
417 if not issubclass_(arg1, generic):
--> 418 arg1 = dtype(arg1).type
419 if not issubclass_(arg2, generic):
420 arg2 = dtype(arg2).type
TypeError: Cannot interpret 'MultiPolygonDtype(float64)' as a data type
The text was updated successfully, but these errors were encountered: