Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if kind is None:
geom_types = set([gt[5:] if 'Multi' in gt else gt for gt in data.geom_type])
if len(geom_types) > 1:
raise ValueError('The GeopandasInterface can only read dataframes which '
'share a common geometry type')
geom_type = list(geom_types)[0]
if geom_type == 'Point':
kind = 'points'
elif geom_type == 'Polygon':
kind = 'polygons'
elif geom_type in ('LineString', 'LineRing'):
kind = 'paths'
elif isinstance(data, pd.DataFrame):
datatype = 'pandas'
self.data = data
elif is_dask(data):
datatype = 'dask'
self.data = data.persist() if persist else data
elif is_streamz(data):
datatype = 'streamz'
self.data = data.example
self.stream_type = data._stream_type
streaming = True
self.cb = data
if data._stream_type == 'updating':
self.stream = Pipe(data=self.data)
else:
self.stream = Buffer(data=self.data, length=backlog, index=False)
data.stream.gather().sink(self.stream.send)
elif is_xarray(data):
import xarray as xr
z = kwds.get('z')
'NdOverlay': dict(plot=self._overlay_opts)}
hist_opts = {'bin_range': self.kwds.get('bin_range', None),
'normed': self.kwds.get('normed', False),
'cumulative': self.kwds.get('cumulative', False)}
if 'bins' in self.kwds:
bins = self.kwds['bins']
if isinstance(bins, int):
hist_opts['num_bins'] = bins
else:
hist_opts['bins'] = bins
if not isinstance(y, (list, tuple)):
if not 'bin_range' in self.kwds:
ys = data[y]
ymin, ymax = (ys.min(), ys.max())
if is_dask(ys):
ymin, ymax = ymin.compute(), ymax.compute()
hist_opts['bin_range'] = ymin, ymax
ds = Dataset(data, self.by)
if self.by:
hist = hists = histogram(
ds.groupby(self.by), dimension=y, **hist_opts
)
hist = hists.last
hists = hists.layout() if self.subplots else hists.overlay()
else:
hists = histogram(ds, dimension=y, **hist_opts)
return hists.opts(opts).redim(**self._redim)
ranges = []