Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,22 @@
|
|
| 1 |
-
|
| 2 |
import pandas as pd
|
| 3 |
import streamlit as st
|
| 4 |
import matplotlib.pyplot as plt
|
|
|
|
|
|
|
| 5 |
import seaborn as sns
|
|
|
|
| 6 |
|
| 7 |
# Dosyaları yükle
|
| 8 |
-
ihtiyac_data = pd.read_excel("ihtiyac_data.xlsx")
|
| 9 |
-
norm_fazlasi = pd.read_excel("norm_fazlasi.xlsx")
|
| 10 |
|
| 11 |
# Streamlit Başlığı
|
| 12 |
-
st.title("
|
| 13 |
|
| 14 |
# Sekmeler
|
| 15 |
tab1, tab2, tab3, tab4, tab5 = st.tabs(["Veri Keşfi", "Görselleştirme", "Analiz", "Sıralama", "Raporlama"])
|
|
|
|
|
|
|
| 16 |
|
| 17 |
with tab1:
|
| 18 |
st.header("Veri Keşfi")
|
|
@@ -30,39 +34,58 @@ with tab1:
|
|
| 30 |
st.write(norm_fazlasi.isnull().sum())
|
| 31 |
|
| 32 |
with tab2:
|
| 33 |
-
st.header("
|
| 34 |
-
|
| 35 |
-
#
|
| 36 |
-
st.subheader("
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
categorical_columns = ihtiyac_data.select_dtypes(include=['object']).columns
|
| 47 |
-
bar_column = st.selectbox("
|
| 48 |
if bar_column:
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
with tab3:
|
| 54 |
st.header("Veri Analizi")
|
| 55 |
|
| 56 |
-
# Korelasyon Matrisi
|
| 57 |
-
st.subheader("Korelasyon Matrisi")
|
| 58 |
-
if len(numeric_columns) > 1:
|
| 59 |
-
corr_matrix = ihtiyac_data[numeric_columns].corr()
|
| 60 |
-
fig, ax = plt.subplots(figsize=(10, 8))
|
| 61 |
-
sns.heatmap(corr_matrix, annot=True, cmap='coolwarm', ax=ax)
|
| 62 |
-
st.pyplot(fig)
|
| 63 |
-
else:
|
| 64 |
-
st.write("Korelasyon analizi için yeterli sayısal sütun yok.")
|
| 65 |
-
|
| 66 |
# Filtreleme
|
| 67 |
st.subheader("Filtreleme")
|
| 68 |
filter_column = st.selectbox("Filtreleme için bir sütun seçin", numeric_columns)
|
|
@@ -90,14 +113,7 @@ with tab5:
|
|
| 90 |
if selected_columns:
|
| 91 |
st.write(ihtiyac_data[selected_columns])
|
| 92 |
|
| 93 |
-
|
| 94 |
-
st.subheader("Grafikli Raporlama")
|
| 95 |
-
x_axis = st.selectbox("X Ekseni için bir sütun seçin", ihtiyac_data.columns)
|
| 96 |
-
y_axis = st.selectbox("Y Ekseni için bir sütun seçin", ihtiyac_data.columns)
|
| 97 |
-
if x_axis and y_axis:
|
| 98 |
-
fig, ax = plt.subplots()
|
| 99 |
-
sns.scatterplot(data=ihtiyac_data, x=x_axis, y=y_axis, ax=ax)
|
| 100 |
-
st.pyplot(fig)
|
| 101 |
|
| 102 |
st.sidebar.title("Hakkında")
|
| 103 |
-
st.sidebar.info("Bu uygulama, veri
|
|
|
|
|
|
|
| 1 |
import pandas as pd
|
| 2 |
import streamlit as st
|
| 3 |
import matplotlib.pyplot as plt
|
| 4 |
+
import plotly.express as px
|
| 5 |
+
import plotly.graph_objects as go
|
| 6 |
import seaborn as sns
|
| 7 |
+
#/Users/donme/Library/Python/3.9/lib/python/site-packages
|
| 8 |
|
| 9 |
# Dosyaları yükle
|
| 10 |
+
ihtiyac_data = pd.read_excel(r"C:\Users\donme\Desktop\MakineÖğrenme\bitirmeProjesi\ihtiyac_data.xlsx")
|
| 11 |
+
norm_fazlasi = pd.read_excel(r"C:\Users\donme\Desktop\MakineÖğrenme\bitirmeProjesi\norm_fazlasi.xlsx")
|
| 12 |
|
| 13 |
# Streamlit Başlığı
|
| 14 |
+
st.title("Antalya İli Öğretmen İhtiyacı Ve Norm Fazlası Veri Seti Analizi")
|
| 15 |
|
| 16 |
# Sekmeler
|
| 17 |
tab1, tab2, tab3, tab4, tab5 = st.tabs(["Veri Keşfi", "Görselleştirme", "Analiz", "Sıralama", "Raporlama"])
|
| 18 |
+
numeric_columns = ihtiyac_data.select_dtypes(include=['float64', 'int64']).columns
|
| 19 |
+
#column = st.selectbox("Histogram için bir sütun seçin", numeric_columns)
|
| 20 |
|
| 21 |
with tab1:
|
| 22 |
st.header("Veri Keşfi")
|
|
|
|
| 34 |
st.write(norm_fazlasi.isnull().sum())
|
| 35 |
|
| 36 |
with tab2:
|
| 37 |
+
st.header("Grafiksel Analiz")
|
| 38 |
+
|
| 39 |
+
# Kullanıcıdan grafik boyutlarını alma
|
| 40 |
+
st.subheader("Grafik Boyutlandırma")
|
| 41 |
+
width = st.slider("Grafik genişliğini ayarlayın (piksel)", 500, 1500, 1500) # Varsayılan genişlik
|
| 42 |
+
height = st.slider("Grafik yüksekliğini ayarlayın (piksel)", 300, 900, 700) # Varsayılan yükseklik
|
| 43 |
+
|
| 44 |
+
# Histogram (Plotly)
|
| 45 |
+
st.subheader("İhtiyaç Histogram Grafiği")
|
| 46 |
+
|
| 47 |
+
if "ihtiyac" in ihtiyac_data.columns: # Sütunun veri setinde mevcut olduğundan emin olun
|
| 48 |
+
fig = px.histogram(
|
| 49 |
+
ihtiyac_data,
|
| 50 |
+
x="ihtiyac",
|
| 51 |
+
marginal="box",
|
| 52 |
+
title="Histogram of İhtiyaç",
|
| 53 |
+
width=width,
|
| 54 |
+
height=height
|
| 55 |
+
)
|
| 56 |
+
fig.update_layout(
|
| 57 |
+
xaxis_title="İhtiyaç",
|
| 58 |
+
yaxis_title="Frequency",
|
| 59 |
+
hovermode="x"
|
| 60 |
+
)
|
| 61 |
+
st.plotly_chart(fig)
|
| 62 |
+
else:
|
| 63 |
+
st.error("Veri setinde 'ihtiyaç' adlı bir sütun bulunamadı.")
|
| 64 |
+
|
| 65 |
+
# Bar Grafiği (Plotly)
|
| 66 |
+
st.subheader("Kategoriye Göre İhtiyaç Sayısı Grafiği")
|
| 67 |
categorical_columns = ihtiyac_data.select_dtypes(include=['object']).columns
|
| 68 |
+
bar_column = st.selectbox("Bir Kategori Seçin", categorical_columns)
|
| 69 |
if bar_column:
|
| 70 |
+
bar_data = ihtiyac_data[bar_column].value_counts().reset_index()
|
| 71 |
+
bar_data.columns = [bar_column, "Count"]
|
| 72 |
+
fig = px.bar(bar_data, x=bar_column, y="Count", title=f"Bar Chart of {bar_column}", width=width, height=height)
|
| 73 |
+
fig.update_layout(xaxis_title=bar_column, yaxis_title="Count", hovermode="x")
|
| 74 |
+
st.plotly_chart(fig)
|
| 75 |
+
|
| 76 |
+
# Scatter Plot (Plotly)
|
| 77 |
+
st.subheader("Dağılım Grafiği")
|
| 78 |
+
x_axis = st.selectbox("X Ekseni için bir sütun seçin", ihtiyac_data.columns, key="scatter_x")
|
| 79 |
+
y_axis = st.selectbox("Y Ekseni için bir sütun seçin", ihtiyac_data.columns, key="scatter_y")
|
| 80 |
+
if x_axis and y_axis:
|
| 81 |
+
fig = px.scatter(ihtiyac_data, x=x_axis, y=y_axis, title=f"Scatter Plot of {x_axis} vs {y_axis}", width=width, height=height)
|
| 82 |
+
fig.update_traces(marker=dict(size=10, color='rgba(0,100,200,0.5)', line=dict(width=1, color='DarkSlateGrey')))
|
| 83 |
+
fig.update_layout(xaxis_title=x_axis, yaxis_title=y_axis, hovermode="closest")
|
| 84 |
+
st.plotly_chart(fig)
|
| 85 |
|
| 86 |
with tab3:
|
| 87 |
st.header("Veri Analizi")
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
# Filtreleme
|
| 90 |
st.subheader("Filtreleme")
|
| 91 |
filter_column = st.selectbox("Filtreleme için bir sütun seçin", numeric_columns)
|
|
|
|
| 113 |
if selected_columns:
|
| 114 |
st.write(ihtiyac_data[selected_columns])
|
| 115 |
|
| 116 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
st.sidebar.title("Hakkında")
|
| 119 |
+
st.sidebar.info("Bu uygulama,Antalya ili öğretmen ihtiyacı ve norm fazlası veri setleri üzerinden veri analizi,verilerin görselleştirilmesi ve filtrelenmesi gibi işlemlerin yapılabilmesi için tasarlanmıştır")
|