Display pandas DataFrame

Hi!

Im trying to display dataframe in a webapp. after receiving inputs from user, I filter the df based on those inputs in my local machine and then want to display it nicely without using to_markdown() .

Ive created a datagrid and then:
def button_1_click(self, **event_args):
----self.repeating_panel_1.items = anvil.server.call(‘main’, user_inputs)

anvil.server.call(‘main’, user_inputs) returns a dict(edit = returns a list of dicts), but the table remains empty, it shows nothing

I succeed to display it in display-text using to_marksown() (but its too ugly) so i guess the problem is in my datagrid

Thank you!

Welcome to the forum!

A data grid expects a list of dicts, not a single dict. If you only have a single dict, a data grid is kind of overkill (it’ll only have one row).

Thank you,
Im sorry, my main function returns a list of dicts.
but even when Im doing it manually(self.repeating_panel_1.items = [{‘column_1’:x1, ‘column_2’:x2,…}])
it shows nothing.
I get this warnings maybe this is the reason:?
Warning: Form1.text_area_country_change does not exist. Trying to set the ‘change’ event handler of self.text_area_country from Form1.

Warning: Form1.data_grid_1_show does not exist. Trying to set the ‘show’ event handler of self.data_grid_1 from Form1.

You’ll probably need to share a clone link to get better advice. Something might be setup wrong in the data grid itself, or an event not hooked up, etc. Keep in mind that sharing a clone means also sharing the contents of data tables, so if your main app isn’t something you want to share, create a smaller app with just the parts you want help on.

1 Like