将传说添加到dash datatable
从以下代码开始,我想为此表格添加一个传说:
from dash import Dash, dash_table
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')
app = Dash(__name__)
app.layout = dash_table.DataTable(df.to_dict('records'), [{"name": i, "id": i} for i in df.columns])
if __name__ == '__main__':
app.run_server(debug=True)
另请参阅: https:// .plotly.com/datatable
我想在屏幕底部有类似的东西:
列 | 说明 |
---|---|
状态 | 收集数据的状态。 |
太阳能电厂的数量 | 是该州太阳能电厂的总数。 |
安装容量(MW) | 兆瓦的安装容量。 |
平均每种植物的 | 平均兆瓦产量产量。 |
(GWH) | 每小时生成gigawatts。 |
Starting from the following code, I'd like to add a legend to this tabular:
from dash import Dash, dash_table
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')
app = Dash(__name__)
app.layout = dash_table.DataTable(df.to_dict('records'), [{"name": i, "id": i} for i in df.columns])
if __name__ == '__main__':
app.run_server(debug=True)
See also: https://dash.plotly.com/datatable
I'd like to have something like this on the bottom of the screen:
Column | Explanation |
---|---|
State | The state for which the data was collected. |
Number of Solar Plants | The total number of solar plants in the state. |
Installed Capacity (MW) | The installed capacity in megawatts. |
Average MW Per Plant | The average power production in megawatts. |
Generation (GWh) | Generated gigawatts per hour. |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于该表靠近并在全显示宽度下显示,因此您可以使用Inine Block插入空间并优化列宽度。
Since the table is displayed close together and at full display width, you can use inine-block to insert spaces and optimize column widths.
我找到了解决问题的解决方案。我只是添加了第二个表格作为传奇。
I found a solution for my problem. I simply added a second tabular as a legend.