Welcome!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

0
Avatar

Administrator

--Administrator--

2508
| 0 0 0
--Administrator--
Administrator
On 11/21/19, 9:52 AM
import dash
from dash.dependencies import Input, Output, State
import dash_table
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import sqlalchemy

app = dash.Dash(__name__)


engine = sqlalchemy.create_engine('mysql+pymysql://root:@127.0.0.1:3306/sfp')

df = pd.read_sql_table("base_case",engine)

app.layout = html.Div([
    html.Div([
        dcc.Input(
            id='adding-rows-name',
            placeholder='Enter a column name...',
            value='',
            style={'padding': 10}
        ),
        html.Button('Add Column', id='adding-rows-button', n_clicks=0)
    ], style={'height': 50}),

    dash_table.DataTable(
        id='adding-rows-table',
        columns=[{"name": i, "id": i} for i in df.columns],
        data=df.to_dict('records'),
        editable=True,
        row_deletable=True
    ),

    html.Button('Add Row', id='editing-rows-button', n_clicks=0),
])

if __name__ == '__main__':
    app.run_server(debug=True)

Keep Informed

About This Community

This community is for professionals and enthusiasts of our products and services. Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/21/19, 9:48 AM
Seen: 33 times
Last updated: 11/21/19, 9:52 AM