File size: 942 Bytes
f3bc26d 8019887 f3bc26d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import numpy as np
import pandas as pd
import streamlit as st
# markdown
st.markdown('Streamlit Demo云申')
# 设置网页标题
st.title('一个傻瓜式构建可视化 web的 Python 神器 -- streamlit')
# 展示一级标题
st.header('1. 安装')
st.text('和安装其他包一样,安装 streamlit 非常简单,一条命令即可')
code1 = '''pip3 install streamlit'''
st.code(code1, language='bash')
# 展示一级标题
st.header('2. 使用')
# 展示二级标题
st.subheader('2.1 生成 Markdown 文档')
# 纯文本
st.text('导入 streamlit 后,就可以直接使用 st.markdown() 初始化')
# 展示代码,有高亮效果
code2 = '''import streamlit as st
st.markdown('Streamlit Demo')'''
st.code(code2, language='python')
df = pd.DataFrame(
np.random.randn(10, 5),
columns=('第%d列' % (i + 1) for i in range(5))
)
# st.table(df.style.highlight_max(axis=0))
st.dataframe(df.style.highlight_max(axis=0))
|