summary reduction containing a by reduction and any other reduction fails
ianthomas23 opened this issue · 0 comments
ianthomas23 commented
This follows #1254 which added support for summary(by)
reduction.
If you use a summary
reduction containing a by
reduction and any other reduction (by
or not), it fails with the following cryptic error:
ValueError: different number of dimensions on data and dims: 3 vs 4
Test script:
import datashader as ds
import numpy as np
import pandas as pd
x = np.arange(2)
df = pd.DataFrame(dict(
y_from = [0.0, 1.0, 0.0, 1.0, 0.0],
y_to = [0.0, 1.0, 1.0, 0.0, 0.5],
value = [1.1, 3.3, 5.5, 2.2, 4.4],
cat = ['a', 'b', 'a', 'b', 'a'],
cat2 = ['C', 'C', 'D', 'D', 'C'],
))
df["cat"] = df["cat"].astype("category")
df["cat2"] = df["cat2"].astype("category")
canvas = ds.Canvas(plot_height=7, plot_width=7)
# All of the following fail:
agg = ds.summary(max=ds.max("value"), other=ds.by("cat"))
#agg = ds.summary(one=ds.by("cat"), other=ds.by("cat", ds.any()))
#agg = ds.summary(one=ds.by("cat"), other=ds.by("cat2"))
canvas.line(source=df, x=x, y=["y_from", "y_to"], axis=1, agg=agg)