The problem you were seeing was definitely related to numpy 1.24. This will be fixed in the next Datashader release, expected to be released next week.
The example is pretty old, this is a more modern way to do it and then launch it with panel serve
import dask.dataframe as dd
import holoviews as hv
import numpy as np
import panel as pn
from holoviews import opts
from holoviews.operation.datashader import aggregate
hv.extension("bokeh")
# Set plot and style options
opts.defaults(
opts.Curve(
xaxis=None,
yaxis=None,
show_grid=False,
show_frame=False,
color="orangered",
framewise=True,
width=100,
),
opts.Image(
width=800,
height=400,
shared_axes=False,
logz=True,
colorbar=True,
xaxis=None,
yaxis=None,
axiswise=True,
bgcolor="black",
cmap="fire",
),
opts.HLine(color="white", line_width=1),
opts.Layout(shared_axes=False),
opts.VLine(color="white", line_width=1),
)
# Read the parquet file
df = dd.read_parquet("~/Downloads/nyc_taxi_wide.parq", engine="fastparquet").compute()
# Declare points
points = hv.Points(df, kdims=["pickup_x", "pickup_y"], vdims=[])
# Use datashader to rasterize and linked streams for interactivity
agg = aggregate(points, link_inputs=True, x_sampling=0.0001, y_sampling=0.0001)
pointerx = hv.streams.PointerX(x=np.mean(points.range("pickup_x")), source=points)
pointery = hv.streams.PointerY(y=np.mean(points.range("pickup_y")), source=points)
vline = hv.DynamicMap(lambda x: hv.VLine(x), streams=[pointerx])
hline = hv.DynamicMap(lambda y: hv.HLine(y), streams=[pointery])
sampled = hv.util.Dynamic(
agg,
operation=lambda obj, x: obj.sample(pickup_x=x),
streams=[pointerx],
link_inputs=False,
)
hvobj = (agg * hline * vline) << sampled
pn.panel(hvobj).servable()