Why Nostr? What is Njump?
2023-01-09 15:27:44
in reply to

dave on Nostr: import dash import dash_core_components as dcc import dash_html_components as html ...

import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd

# Create the Dash app
app = dash.Dash(__name__)

# Read the Data
df = pd.read_csv('data.csv')

# Create a Dash Layout
app.layout = html.Div([
# Add a header and a paragraph
html.H1("Dashboard Showing DatePickerSingle"),
html.P("This dashboard filters data based on DatePickerSingle"),
# Add a DataTable
dcc.DatePickerSingle(
id='date_picker_single',
min_date_allowed=df['date'].min(),
max_date_allowed=df['date'].max(),
initial_visible_month=df['date'].min(),
date=df['date'].max()
),
# Add a Table
dcc.Graph(
id="table",
figure={
'data': [{
'type':'table',
'columnwidth': [500, 500],
'columnorder': [0, 1],
'header': {
'values': list(df.columns),
'align': 'center',
'fill': {'color': '#C2D4FF'},
'font': {'size': 18},
},
'cells': {
'values': df.T.values.tolist(),
'fill': {'color': '#F5F8FF'},
'font': {'size': 14},
'align': 'center',
}
}]
},
config={'displayModeBar': False})
])

# Update the Index
@app.callback(
dash.dependencies.Output('table', 'figure'),
[dash.dependencies.Input('date_picker_single', 'date')])
def update_graph(selected_date):
# Filter the data based on the selected date
filtered_df = df[df['date'] == selected_date]

# Create the Table
table_trace
Author Public Key
npub1tsgw6pncspg4d5u778hk63s3pls70evs4czfsmx0fzap9xwt203qtkhtk4