Black Lives Matter. Please consider donating to Black Girls Code today.

Two column table

Hi beginner here,

I’m trying to create a table for a Plotly Dash webapp.

From the data in the dataframe I want to create the following table (Two column table, column name on one side, and values on the other):

Column Name | Value

I’m using the logic below but its just giving me a table with one column and stacks values and columns names in the same column.

return html.Table(

    # Header

    [html.Tr([html.Tr(col) for col in dataframe.columns])] +

    # Body

    [html.Td([

        html.Td(dataframe.iloc[i][col]) for col in dataframe.columns

    ]) for i in range(min(len(dataframe), max_rows))]

For those familiar with html this is what I’m trying to do:

<table>
<tr>
<td>Column Name:</td>
<td>Values:</td>
</tr>

Hi @Unixmad, welcome to the forum! Did you take a look at

Thanks for pointing me in the right direction.