python -m venv veri-dashboard
cd veri-dashboard
Scripts\activate
pip install pandas==2.2.2 plotly==5.22 streamlit==1.38 openpyxl python-dotenv| [th]Дата[/th] [th]Продукт[/th] [th]Категорія[/th] [th]Кількість[/th] [th]Ціна[/th] [th]Місто[/th] [th]Оплата[/th] | ||||||
| 2025-01-15 | iPhone 16 | Електроніка | 2 | 45000 | Стамбул | Кредит |
| 2025-01-16 | Светр | Одяг | 5 | 850 | Анкара | Готівка |
| ... | ... | ... | ... | ... | ... | ... |
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
from datetime import datetime
import locale
# Встановлення локалі для Туреччини 2025
locale.setlocale(locale.LC_TIME, 'tr_TR.UTF-8')
# Завантаження даних
df = pd.read_excel("satislar_2025.xlsx", parse_dates=["Tarih"])
# Очищення
df["Toplam"] = df["Adet"] * df["Fiyat"]
df["Ay"] = df["Tarih"].dt.strftime("%Y-%m")
df["Gün"] = df["Tarih"].dt.day_name(locale='tr_TR')
print("Загальний дохід:", f"₺{df['Toplam'].sum():,}")
print("Найпопулярніша категорія:", df.groupby("Kategori")["Adet"].sum().idxmax())import streamlit as st
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
from pathlib import Path
st.set_page_config(page_title="Дашборд продажів 2025", layout="wide", page_icon="📊")
# Темний режим
st.markdown("""
<style>
.css-1d391kg {padding-top: 1rem; padding-bottom: 3rem;}
.css-18e3th9 {padding-top: 1rem;}
</style>
""", unsafe_allow_html=True)
@st.cache_data
def load_data():
df = pd.read_excel("satislar_2025.xlsx", parse_dates=["Tarih"])
df["Toplam"] = df["Adet"] * df["Fiyat"]
df["Ay"] = df["Tarih"].dt.strftime("%Y-%m")
df["Ay Adı"] = df["Tarih"].dt.strftime("%B %Y")
return df
df = load_data()
st.title("Дашборд продажів електронної комерції в Туреччині - 2025")
st.markdown("---")
# KPI
col1, col2, col3, col4 = st.columns(4)
total_revenue = df["Toplam"].sum()
total_orders = len(df)
avg_basket = total_revenue / total_orders if total_orders > 0 else 0
top_city = df["Şehir"].value_counts().index[0]
col1.metric("Загальний оборот", f"₺{total_revenue:,.0f}")
col2.metric("Загальна кількість замовлень", f"{total_orders:,}")
col3.metric("Середній чек", f"₺{avg_basket:,.0f}")
col4.metric("Найпопулярніше місто", top_city)
st.markdown("---")
# Тренд продажів за місяцями
col1, col2 = st.columns(2)
with col1:
monthly = df.groupby("Ay")["Toplam"].sum().reset_index()
template = "plotly_dark" if st.checkbox("Темний режим", True) else "plotly"
fig = px.line(monthly, x="Ay", y="Toplam", title="Тренд обороту за місяцями", markers=True, template=template)
fig.update_yaxes(title="Оборот (TL)", tickprefix="₺")
st.plotly_chart(fig, use_container_width=True)
with col2:
category = df.groupby("Kategori")["Toplam"].sum().reset_index()
fig2 = px.pie(category, values="Toplam", names="Kategori", title="Розподіл продажів за категоріями")
st.plotly_chart(fig2, use_container_width=True)
# Продажі за містами
st.subheader("Продажі за містами")
city_sales = df.groupby("Şehir")["Toplam"].sum().reset_index()
fig3 = px.bar(city_sales.sort_values("Toplam", ascending=False).head(10), x="Şehir", y="Toplam", title="Топ-10 міст за продажами")
st.plotly_chart(fig3, use_container_width=True)
# Таблиця + фільтри
st.subheader("Детальна таблиця продажів")
kategori_sec = st.multiselect("Оберіть категорію", df["Kategori"].unique(), default=df["Kategori"].unique())
sehir_sec = st.multiselect("Оберіть місто", df["Şehir"].unique(), default=df["Şehir"].unique())
filtered = df[df["Kategori"].isin(kategori_sec) & df["Şehir"].isin(sehir_sec)]
st.dataframe(filtered, use_container_width=True)
# Експорт в Excel
csv = filtered.to_csv(index=False).encode('utf-8')
st.download_button("Завантажити Excel", csv, "satislar_filtreli.csv", "text/csv")
streamlit run app.py
# http://localhost:8501git init
git add .
git commit -m "first"
# streamlit.io → New app → Підключіть репозиторій GitHub → Deploy
# https://satis-dashboard-2025.streamlit.apprailway login
railway init
railway up
# Автоматичне розгортання| [th]Інструмент[/th] [th]Час розгортання[/th] [th]Сумісність з мобільними[/th] [th]Інтерактивність[/th] [th]Вартість[/th] | ||||
| Power BI | 10+ хвилин | Середня | Середня | $10/міс |
| Tableau | 15+ хвилин | Гарна | Гарна | $70/міс |
| Streamlit + Plotly | 30 секунд | Відмінна | Відмінна | Безкоштовно |