The below code worked on 0.14.2 and on 0.15.0 it doesn't get the correct dshape in the category_codes reducer. It wasn't obvious to me why adding a second category "fixed it"
NotImplementedError: Unexpected dshape <function dshape at 0x7f0dfed1da20>
import pandas as pd
import numpy as np
from collections import OrderedDict as odict
import datashader as ds
num=100
np.random.seed(1)
dists = {cat: pd.DataFrame(odict([('x',np.random.normal(x,s,num)),
('y',np.random.normal(y,s,num)),
('c',np.random.randint(0,val,num)),
('t',cat)]))
for x, y, s, val, cat in
[( 2, 2, 0.03, 10, "d1")] }
df = pd.concat(dists,ignore_index=True)
categories = ['d1']
cat_dtype = pd.api.types.CategoricalDtype(categories=categories, ordered=True)
df["t"] = df["t"].astype(cat_dtype)
agg = ds.Canvas(
plot_height=256,
plot_width=256,
x_range=(-8,8),
y_range=(-8,8)
).points(df, "x", "y", agg=ds.by("t", ds.sum("c")))
a "fix" is to add a second category if the length is 1
categories=['d1']
if len(categories) == 1:
categories.append('')
The below code worked on 0.14.2 and on 0.15.0 it doesn't get the correct dshape in the category_codes reducer. It wasn't obvious to me why adding a second category "fixed it"
NotImplementedError: Unexpected dshape <function dshape at 0x7f0dfed1da20>
a "fix" is to add a second category if the length is 1