Hi Marc, thanks for your reply and offer of help. Here reproducible code to show the problem.
import panel as pn
import pandas as pd
import numpy as np
pn.extension(comms='vscode')
pn.config.sizing_mode = 'stretch_width'
df = pd.DataFrame()
ID_CreditSC_App = pn.template.BootstrapTemplate()
mainColumn = pn.Column()
df_tabulator = pn.widgets.Tabulator(df,name='Original Dataset', disabled =True, height=400, pagination='remote', page_size=50)
df_tabulator1 = pn.widgets.Tabulator(df,name='Original Dataset', disabled =True, height=400, pagination='remote', page_size=50)
tabs_dataset = pn.Tabs(
(df_tabulator),
(df_tabulator1)
)
multiSelect = pn.widgets.MultiSelect(name='Segmentation value', size=8)
btn_main = pn.widgets.Button(name='Main')
btn_dataset = pn.widgets.Button(name='Dataset')
btn_loadSelector = pn.widgets.Button(name='Load')
btn_loadTable = pn.widgets.Button(name='Load')
def mainClick(event):
mainColumn[:] = mainView
def datasetClick(event):
mainColumn[:] = datasetView
def init_df():
for i in range(100):
df.insert(0, 'Column' + str(i), np.random.randint(0, 10, 10000))
def loadSelector(event):
multiSelect.options = df['Column1'].values.tolist()
def loadTable(event):
df_tabulator.value = df
df_tabulator1.value = df
btn_main.on_click(mainClick)
btn_dataset.on_click(datasetClick)
btn_loadSelector.on_click(loadSelector)
btn_loadTable.on_click(loadTable)
mainView = [btn_loadSelector,multiSelect]
datasetView = [btn_loadTable, tabs_dataset]
init_df()
ID_CreditSC_App.sidebar.append(btn_main)
ID_CreditSC_App.sidebar.append(btn_dataset)
ID_CreditSC_App.main.append(mainColumn)
ID_CreditSC_App.servable()
To 1.) I am using a randomly generated dataframe (this serves as an example for our real data) with 10000 rows and 100 columns, which is loaded into a tabulator widget. I believe that the number of rows has little to no effect on speed, but the number of columns does. The original code I am working on uses two tabs (each with a tabulator widget, a copy of the data is loaded into the second tabulator and in the following workflow is modified step by step). This double loading can slow down the process a bit but is necessary for the app’s purpose to later have an overview and quickly be able to compare them.
The described process of loading the dataframe into the tabulator is initiated by clicking the “Load” button on the Dataset page (also for simulation purpose). The fact that it takes long the first time would not be a problem for my purposes. But it would be great if the page did not freeze during the loading process.
Similarly, on the main page the MultiSelect widget options can be updated with the corresponding “Load” button on that page. Here the contents of an entire column of the dataframe and its 10000 entries are used. This also takes a very long time. Is there any way to speed this up?
To 2.) Once the initial loading to the tabulator widget finished and I switch between the two pages (Main & Dataset), it seems like everything is reloaded again. I would really like to avoid this “reloading/rendering” to allow quick switching between the two pages.
Thanks!