How will i swap column as row and row as column in bokeh tata table

I am trying to swap the data table column as row row as column based on teh react form value i need to customize the bokeh table dynamically how will i do,

lets explain breifely,

i have an react application, in thet i have the draggable ,menu list, when i drop the menu item uit render the bokeh charts, table, the bokeh contents are written in the python .I connect the python file using the flask server . ijn tyhis if i receive the chart type 13 that time i need to drop the bokeh datatable in react i have the form that form contain some option like excel sheet if the condtional column and the APPLY COLUMN AND CONDTION TYPE BASED ON THE CONDITION I NEED TO MAKE THE BOLD,ITALIC, UNDERLINE COLOR CHANGE AND BACKGROUND COLORING IN THE FRONT END CODE, HOW WILL I DO

IN THE 2nd image swap button click i need to swap the row as the column and column as the row …elif chart_type == 13:

        data_key = 'data'  # Replace this with the actual key in your dictionary

# Use table_data to generate the Bokeh DataTable
        df = pd.DataFrame(table_data.get(data_key, [])) 
        # if is_transposed:
        # # Transpose the DataFrame
        #     print("fghfghfghfghfghfghfhf")
        #     df = df.transpose()
        #     print(df)
        transposed_df = df.transpose()
        source = ColumnDataSource(df)
        # source = ColumnDataSource( transposed_df )
        # stats = df.describe().reset_index()
        # source_stats = ColumnDataSource(stats)
        columns = [TableColumn(field=col, title=col,) for col in df.columns]
        p = DataTable(source=source, columns=columns,editable=True) this is my python code for bokeh  datatable

The data table is always and only driven by a ColumnDataSource. A CDS is always a mapping of column names to sequences of data (e.g. lists, numpy arrays, pandas series, etc). There is nothing at all built in to do any sort of “transposition”. There can’t be any generic way to do that, because what should the new column names be for the transposed data? The answer to that question is entirely dependent on the details and specifics of your problem (of which you have provided no information whatsoever).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.