44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
import pandas as pd
|
|
import streamlit as st
|
|
from numpy.random import default_rng as rng
|
|
|
|
# Данные
|
|
df = pd.DataFrame(
|
|
{
|
|
"name": ["Roadmap", "Extras", "Issues"],
|
|
"url": [
|
|
"https://roadmap.streamlit.app",
|
|
"https://extras.streamlit.app",
|
|
"https://issues.streamlit.app",
|
|
],
|
|
"stars": rng(0).integers(0, 1000, size=3),
|
|
"views_history": rng(0).integers(0, 5000, size=(3, 30)).tolist(),
|
|
}
|
|
)
|
|
|
|
# Найдём максимальное значение звёзд
|
|
max_stars = df["stars"].max()
|
|
|
|
# Добавим визуальное выделение — например, дополнительную звезду или эмодзи 🔥
|
|
df["stars_display"] = df["stars"].apply(
|
|
lambda x: f"{x} ⭐🔥" if x == max_stars else f"{x} ⭐"
|
|
)
|
|
|
|
# Отображаем в Streamlit
|
|
st.dataframe(
|
|
df,
|
|
column_config={
|
|
"name": "App name",
|
|
"stars_display": st.column_config.TextColumn(
|
|
"Github Stars",
|
|
help="Number of stars on GitHub (🔥 = max)",
|
|
),
|
|
"url": st.column_config.LinkColumn("App URL"),
|
|
"views_history": st.column_config.LineChartColumn(
|
|
"Views (past 30 days)", y_min=0, y_max=5000
|
|
),
|
|
},
|
|
column_order=["name", "url", "stars_display", "views_history"],
|
|
hide_index=True,
|
|
)
|