Код: Выделить всё
HTML Pandas Dataframe with CSS
team
player
week
year
x
y
0
[img]https://a.espncdn.com/i/teamlogos/nfl/500/kc.png[/img]
[img]https://static.www.nfl.com/image/private/f_auto,q_auto/league/xw0jhb7zeobj4bkxfpwg[/img]
1
2020
15
10
.
Код: Выделить всё
html_string = """
HTML Pandas Dataframe with CSS
{table}
.
"""
import streamlit as st
import streamlit.components.v1 as components
import pandas as pd
html_string.format(
table=df.to_html(
classes="mystyle",
escape=False,
formatters=format_dict,
justify="center",
)
)
Код: Выделить всё
.mystyle {
font-size: 11pt;
font-family: Arial;
border-collapse: collapse;
border: 1px solid rgb(237, 69, 69);
}
Код: Выделить всё
components.html(
html_string.format(
table=df.to_html(
classes="mystyle",
escape=False,
formatters=format_dict,
justify="center",
)
),
)
РЕДАКТИРОВАТЬ: в этом сообщении о формах с потоковой подсветкой я смог заставить CSS отображаться с помощью поместив его в статическую папкуstreamlit. Теперь вопрос в том, будет ли CSS по-прежнему отображаться правильно, если все мои файлы будут храниться в репозитории GitHub?
Подробнее здесь: https://stackoverflow.com/questions/732 ... -streamlit
Мобильная версия