medical-kiban commited on
Commit
941851a
·
1 Parent(s): 2ef788a

no message

Browse files
Files changed (2) hide show
  1. app.py +64 -0
  2. requirements.txt +6 -0
app.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import matplotlib.pyplot as plt
4
+ import japanize_matplotlib
5
+ import seaborn as sns
6
+ import numpy as np
7
+
8
+ st.set_page_config(page_title="データ分析ダッシュボード", layout="wide")
9
+
10
+ st.title("📊 データ分析ダッシュボード")
11
+
12
+ uploaded_file = st.file_uploader("CSVファイルをアップロードしてください", type=["csv"])
13
+
14
+ if uploaded_file is not None:
15
+ df = pd.read_csv(uploaded_file)
16
+ st.success("✅ ファイルを読み込みました!")
17
+
18
+ st.header("📌 データのプレビュー")
19
+ st.dataframe(df.head())
20
+
21
+ st.header("📊 基本統計情報")
22
+ st.write(df.describe())
23
+
24
+ st.header("📈 カラムごとの分布表示")
25
+ column = st.selectbox("分布を見たいカラムを選んでください", df.select_dtypes(include=np.number).columns)
26
+
27
+ fig, ax = plt.subplots()
28
+ sns.histplot(df[column], kde=True, ax=ax)
29
+ ax.set_title(f"{column} のヒストグラム")
30
+ st.pyplot(fig)
31
+
32
+ numeric_df = df.select_dtypes(include=["number"])
33
+ fig_corr, ax_corr = plt.subplots()
34
+ sns.heatmap(numeric_df.corr(), annot=True, cmap="coolwarm", fmt=".2f", ax=ax_corr)
35
+ st.pyplot(fig_corr)
36
+
37
+ st.header("📊 ボックスプロット")
38
+ box_col = st.selectbox("ボックスプロットの対象カラムを選択", df.select_dtypes(include=np.number).columns, key="box")
39
+ fig_box, ax_box = plt.subplots()
40
+ sns.boxplot(x=df[box_col], ax=ax_box)
41
+ ax_box.set_title(f"{box_col} のボックスプロット")
42
+ st.pyplot(fig_box)
43
+
44
+ st.header("📈 折れ線グラフ")
45
+ if df.select_dtypes(include=np.number).shape[1] >= 2:
46
+ line_x = st.selectbox("X軸に使うカラムを選択", df.select_dtypes(include=np.number).columns, key="line_x")
47
+ line_y = st.selectbox("Y軸に使うカラムを選択", df.select_dtypes(include=np.number).columns, key="line_y")
48
+
49
+ fig_line, ax_line = plt.subplots()
50
+ sns.lineplot(x=df[line_x], y=df[line_y], ax=ax_line)
51
+ ax_line.set_title(f"{line_x} vs {line_y} 折れ線グラフ")
52
+ st.pyplot(fig_line)
53
+
54
+ st.header("📊 カテゴリカルデータの棒グラフ")
55
+ cat_columns = df.select_dtypes(include='object').columns
56
+ if len(cat_columns) > 0:
57
+ cat_col = st.selectbox("カテゴリカルカラムを選択", cat_columns)
58
+ fig_bar, ax_bar = plt.subplots()
59
+ df[cat_col].value_counts().plot(kind='bar', ax=ax_bar)
60
+ ax_bar.set_title(f"{cat_col} の頻度棒グラフ")
61
+ st.pyplot(fig_bar)
62
+
63
+ else:
64
+ st.info("左側のサイドバーからCSVファイルをアップロードしてください。")
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ streamlit
2
+ pandas
3
+ matplotlib
4
+ japanize-matplotlib
5
+ seaborn
6
+ numpy