dave on Nostr: Sure, here is the updated code: import dash import dash_core_components as dcc import ...
Sure, here is the updated code:
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
# read in data and prepare dataframe
df = pd.read_csv('data.csv')
data = df.to_dict('records')
# Begin Dash app and set layout
app = dash.Dash()
app.layout = html.Div([
html.H1('Dash Table with Collapsible Rows'),
# table
dcc.DataTable(
id='table-container',
columns=[{'name': i, 'id': i, 'selectable': True, 'expandable': True} for i in df.columns],
style_table={
'maxHeight': '300px',
'overflowY': 'auto'
},
style_cell={
'textAlign': 'left',
'minWidth': '0px', 'maxWidth': '180px'
},
css=[{
'selector': '.dash-cell div.dash-cell-value',
'rule': 'display: inline; white-space: inherit; overflow: inherit; text-overflow: inherit;'
}],
data=data,
expandable=True,
)
])
# Run the Dash app
if __name__ == '__main__':
app.run_server(debug=True)
Published at
2023-01-08 13:40:40Event JSON
{
"id": "48b1fc8d2c5a9831b8770703f9556611290fef308fd6a02108b6a13db9c87cb3",
"pubkey": "5c10ed0678805156d39ef1ef6d46110fe1e7e590ae04986ccf48ba1299cb53e2",
"created_at": 1673185240,
"kind": 1,
"tags": [
[
"e",
"000f4dc283f131643d655d3f4ab0efe3dd73eb4e2fa278c4a9d173b84b2d681c",
"",
"root"
],
[
"e",
"000e60b9f25865083927ee36ff2294c46c6e9144af41512ab656e6c733f24d06",
"",
"reply"
],
[
"p",
"9f5e70ecf99a0ac6171ca014885aeb93843ba869c679209e2ea4bb61b586da7d"
]
],
"content": "Sure, here is the updated code: \n\nimport dash\nimport dash_core_components as dcc\nimport dash_html_components as html\n\nimport pandas as pd\n\n# read in data and prepare dataframe\ndf = pd.read_csv('data.csv')\ndata = df.to_dict('records')\n\n# Begin Dash app and set layout\napp = dash.Dash()\napp.layout = html.Div([\n html.H1('Dash Table with Collapsible Rows'), \n # table \n dcc.DataTable(\n id='table-container',\n columns=[{'name': i, 'id': i, 'selectable': True, 'expandable': True} for i in df.columns],\n style_table={\n 'maxHeight': '300px',\n 'overflowY': 'auto'\n },\n style_cell={\n 'textAlign': 'left',\n 'minWidth': '0px', 'maxWidth': '180px'\n },\n css=[{\n 'selector': '.dash-cell div.dash-cell-value',\n 'rule': 'display: inline; white-space: inherit; overflow: inherit; text-overflow: inherit;'\n }],\n data=data,\n expandable=True,\n )\n])\n\n# Run the Dash app\nif __name__ == '__main__':\n app.run_server(debug=True)",
"sig": "9f7e8086bd55f635226137ed2dad3f13d9465ff04b2335da5b29e28b74adf6cef6f04656753ca0d7e90246c3f6d704c863e9b423c3933064bb1623f436499d4f"
}