holoviz/param

RX: output not updated when indexing a DataFrame with value_start/value_end

Closed this issue · 1 comments

Not sure to which extent this is a Panel/Param issue.

import numpy as np
import pandas as pd
import panel as pn

df = pd.DataFrame(np.random.random((100, 2)))
w_i = pn.widgets.IntRangeSlider(start=1, end=99)
dfr = pn.rx(df)
out = dfr[w_i.param.value_start:w_i.param.value_end].head()
out

Monosnap screencast 2024-05-22 14-13-09_gifski

I think I can reproduce this behavior without Panel:

import param, numpy as np, pandas as pd

df = pd.DataFrame(np.random.random((100, 2)))
start = param.rx(1)
end = param.rx(99)
dfr = param.rx(df)
dfr[start:end].head()
image
start.rx.value=5
dfr[start:end].head()
image

I.e., since start and df are reactive, updating start should have caused the first head expression output to be updated to match the second one. But maybe I'm confused about the display of reactive dataframes.