【发布时间】:2022-01-20 17:40:50
【问题描述】:
如何更改列标题?第一列标题应为“4 年”,第二列标题应为“2 年”。我尝试使用 label={},但一直出错。
df = pd.read_csv('college_data.csv')
df1 = df[df.years > 2]
df2 = df[df.years < 3]
#CUNY College Table
fig = go.Figure(data=[go.Table(
header=dict(values=list(df1[['college_name', 'college_name']]),
fill_color='paleturquoise',
font_color='gray',
align='left',
height = 50,
font=dict(size=26),
),
cells=dict(values=[df1.college_name, df2.college_name],
height = 50,
fill_color='lavender',
align='left',
font=dict(size=20),
))
])
fig.update_layout(title = "CUNY Colleges",
width = 900,
height = 1320,
font_family='Palanquin',
font=dict(size=30),
showlegend = False)
st.plotly_chart(fig)
【问题讨论】:
标签: python pandas plotly-python streamlit