Orienting Dash DataTable horizontally


I have a simple dataframe with four columns:

  • date
  • price1
  • price2
  • price3

So it’s basically time series table, showing price for each date point. Table is oriented vertically as in standard Pandas DataFrame.

I want to create editable Dash DataTable, but I need data to be oriented horizontally, so that first column shows column names from my table (data, price 1, price 2, price 3), first row shows dates, second row shows price 1 values and so on.

How can I do it?

hey @golovinroman1980,

You may try transposing your DataFrame before putting it into DataTable with df.T


1 Like


If I make df.T - I will not be able to supply columns = [date, price1, price2, price3] to dash_table.DataTable. Instead I will have to define columns as [prices, data1, data2, data3, data4, …].

I want to define dash_table.DataTable as ususal, but I want it to be oriented horizontally, not vertically.

Hey @golovinroman1980,

If you do df.T; df.T.index.values becomes your columns. You can insert that into columns prop of dash_table.DataTable

1 Like