Select tabs with dp.Text format not displaying correctly
jmrichardson opened this issue · comments
System Information
- OS: Windows
- Python version: 3.8
- Python environment: pip
- Using jupyter: false
- Datapane version: 0.14.0
Bug / Issue
Hi,
Using Select, dp.Text with format option does not display label correctly. It shows "section 3" instead of "Features" as coded below:
self.page_dp = dp.Page(
title=self.title + " " + str(task),
blocks=[
dp.Select(
type=dp.SelectType.TABS,
blocks=[
dp.Text(info, label='Info'),
dp.HTML(html, label='Performance'),
dp.Text(inputs, label='Features').format(
features=dp.DataTable(pd.concat([train_df.head(10), train_df.tail(10)], axis=0)),
raw=dp.DataTable(pd.concat([raw.head(10), raw.tail(10)], axis=0)),
testpred=dp.DataTable(pd.concat([test_pred_lbl.head(10), test_pred_lbl.tail(10)], axis=0)),
),
]
),
]
)
dp.Report(self.page_dp).save("rpt.html", open=True)
The following is screen shot of selects where "Section 3" should be "Features":
Thanks for any help.
Thank you for raising this @jmrichardson!
I've reproduced the issue and it does indeed look like a bug that will need fixing.
If you need an immediate solution in the meantime, I have the labels working correctly by wrapping the blocks with dp.Group
:
import datapane as dp
page_dp = dp.Page(
title="self.title" + " " + str("task"),
blocks=[
dp.Select(
type=dp.SelectType.TABS,
blocks=[
dp.Group(dp.Text("info"), label="Info"),
dp.Group(dp.HTML("html"), label="Performance"),
dp.Group(
dp.Text("inputs").format(
raw="dp.DataTable(pd.concat([raw.head(10), raw.tail(10)], axis=0))",
testpred="dp.DataTable(pd.concat([test_pred_lbl.head(10), test_pred_lbl.tail(10)], axis=0))",
),
label="Features",
),
],
),
],
)
dp.Report(page_dp).save("rpt.html", open=True)
My example has strings in place of your variables for testing. I hope it helps!
Thank you so much for the fast reply and workaround! Also, thank you for this great reporting tool! :)