Table with changing rows & columns ... how can I do this?

hi

at this momment, I use a raw display of data. It’s shown like this:

but I would like to organize it in a table, deppending of the clusters used, the table will modify the ammount of columns and rows. Which is the best way to do this?

saludos you r a ped.

I will explain more (to be more helpfull).

this are the imputs:

if I have 12 cluscers … the centroids look like this:

but with 3 cluseters, it looks like this

How can I make a table, that rearanges the columns and rows from what I’ve chosen for number of clusters?

The number of rows, is equal to 7 (this is fixed) … but the ammount of columns change … how can I make this?

Im getting this error: (I know its explicit, but dont know how to solve this):


raise exceptions.InvalidCallbackReturnValue(
dash.exceptions.InvalidCallbackReturnValue: The callback for `<Output `cluster-table.dash_table`>`
                returned a value having type `Dash`
                which is not JSON serializable.


The value in question is either the only value returned,
or is in the top level of the returned list,

                and has string representation
                `<dash.dash.Dash object at 0x00000197C2A37D90>`

                In general, Dash properties can only be
                dash components, strings, dictionaries, numbers, None,
                or lists of those.

edit2:
I managed to see the table, and as it changes … it was simpler than I thought, just added this:

columns =  [{"name": i, "id": i,} for i in (dff7.columns)]
        return dt.DataTable(data=data, columns=columns)

but, I see the table as in raw … all white cells with white numbers (so I can’t see it till I select a cell) …

dbc.Col([
                                    html.Div(id='cluster-table',style={
                                    "color":"#f0f8ff",
                                    "background-color": "#000000"{),

how can I stile this to see the caps in black? or viceverse?

edit3:

made it, just changed the colors…

now, the only thing I have left to do … (if this is possible), is to add the labels (selected columns) instead of the numbers from 0 to 7, how can I do this?

Hola @topotaman
No me queda claro cual problema te queda por resolver, es solo el titulo en la tabla ?
Podrías publicar todo el código?
Saludos.

ya, lo siento, he ido resolviendo las dudas … solo me quedaba añadir los nombres de las columnas de
las variables de entrada

1 Like