Table Formatting

Hi, recently discovered Datapane and think it’s a great idea. One stumbling block I can’t find in the documentation is how to format a table? In particular for a smaller table reducing the width, and removing the ‘Next’ bar (which becomes most of the size of the table in the report for a small table).

I’m sure if must be doable, I just haven’t worked it out.

Thanks for the help,

David

Hey David, thanks for the suggestion.

This isn’t something that currently exists, but we can definitely look at making our Table element more configurable and flexible.

For the Next bar, we can make this configurable, but would you be able to share a screenshot of it taking up most of the Table component? I want to double check there isn’t a bug there, as I can’t reproduce.

Additionally, one thing which may affect width is that we will soon be releasing layout features which allow you to have more flexible column/row grid layouts in your reports – this would mean you could put some text next to a table, for instance.

Thanks a lot!
Leo

Thanks for getting back to me Leo,

I’ve attached a screen grab. In this case it’s basically some descriptive stats for the 1, 2 and 3 year point on a simulation. What would be great is being able to easily format the numbers (say some float at 0dp, some as percent 2dp), adjust the column widths, remove the past/next bar & remove the filter boxes. If possible I’d also add an option for a “totals” line.

image

Hopefully makes the point that all the extra stuff is really overkill to show what is really 3 columns of data. I do really like the download button on your reports which is a great and easy to use functionality that I’d like to implement.

In case it’s useful I’ve put a screenshot of how the same table currently looks in a report I generate (as a plotly table); don’t think a component needs to be as attractive as a plotly table but some basic adjusting would be great.

I suppose a slight aside would be if any of the components you support offer a decent table? Unfortunately it’s a very weak area for Plotly.

Thanks,

David

Yeah, I totally see where you are coming from here.

I’ve been digging into this a bit, and we can improve our table component – right now the columns are actually inferred from the types in your DataFrame. In your ideal world, it sounds like you’d like to set the format schema so you would have some control over this? A similar use-case would be something like currency, where I could set a column as $ or £?

Allowing the previous/next bar should be simple and removing filter should be simple, and I’d recommend we hide the previous/next bar automatically if there is only a single page (it’s redundant in your example).

I’m a a little less sure on totals, as that would require us to do a bit more calculation (either in the client-side library, or on the FE). In your example, this would be simple, but some folks upload 2m row datasets which get lazily-loaded in, so this could get a little complex. Is there a better way to solve this where you calculate it in your DataFrame?

I was just thinking - for a very lightweight table, another option is to use Markdown. DataFrames have a to_markdown() field, so you can do dp.Report(df.to_markdown()) in order to generate a non-responsive markdown table, like this:

For some tables which are non-interactive, this could be a good option.

I’m opening a ticket to try and improve these issues for you. Thanks so much for your feedback :slight_smile: