Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -88,6 +88,7 @@ def apply_slicers(data, slicers):
|
|
| 88 |
data = data[data[col].isin(selected_values)]
|
| 89 |
return data
|
| 90 |
|
|
|
|
| 91 |
def perform_analysis(data):
|
| 92 |
st.header("νμμ λ°μ΄ν° λΆμ")
|
| 93 |
|
|
@@ -111,14 +112,18 @@ def perform_analysis(data):
|
|
| 111 |
else:
|
| 112 |
st.write("μκ΄κ΄κ³ ννΈλ§΅μ 그릴 μ μλ μ«μν μ΄μ΄ μμ΅λλ€.")
|
| 113 |
|
| 114 |
-
#
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
-
#
|
| 120 |
-
x = filtered_data[
|
| 121 |
-
y = filtered_data[
|
| 122 |
slope, intercept, r_value, p_value, std_err = stats.linregress(x, y)
|
| 123 |
line_x = np.array([x.min(), x.max()])
|
| 124 |
line_y = slope * line_x + intercept
|
|
@@ -126,7 +131,9 @@ def perform_analysis(data):
|
|
| 126 |
|
| 127 |
r_squared = r_value ** 2
|
| 128 |
fig.update_layout(
|
| 129 |
-
title=f'
|
|
|
|
|
|
|
| 130 |
annotations=[
|
| 131 |
dict(
|
| 132 |
x=0.5,
|
|
@@ -140,20 +147,10 @@ def perform_analysis(data):
|
|
| 140 |
)
|
| 141 |
st.plotly_chart(fig)
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
st.write("
|
| 146 |
-
|
| 147 |
-
fig.update_layout(title='λ°λ³ μ±μ λΆν¬')
|
| 148 |
-
st.plotly_chart(fig)
|
| 149 |
-
|
| 150 |
-
# μΆμμΌμ ꡬκ°λ³ μ±μ λΆν¬
|
| 151 |
-
if 'μΆμμΌμ' in filtered_data.columns and 'μ±μ ' in filtered_data.columns:
|
| 152 |
-
st.write("μΆμμΌμ ꡬκ°λ³ μ±μ λΆν¬:")
|
| 153 |
-
filtered_data['μΆμμΌμ_ꡬκ°'] = pd.cut(filtered_data['μΆμμΌμ'], bins=5)
|
| 154 |
-
fig = px.box(filtered_data, x='μΆμμΌμ_ꡬκ°', y='μ±μ ', color='λ°')
|
| 155 |
-
fig.update_layout(title='μΆμμΌμ ꡬκ°λ³ μ±μ λΆν¬')
|
| 156 |
-
st.plotly_chart(fig)
|
| 157 |
|
| 158 |
def main():
|
| 159 |
st.title("μΈν°λν°λΈ EDA ν΄ν·")
|
|
|
|
| 88 |
data = data[data[col].isin(selected_values)]
|
| 89 |
return data
|
| 90 |
|
| 91 |
+
|
| 92 |
def perform_analysis(data):
|
| 93 |
st.header("νμμ λ°μ΄ν° λΆμ")
|
| 94 |
|
|
|
|
| 112 |
else:
|
| 113 |
st.write("μκ΄κ΄κ³ ννΈλ§΅μ 그릴 μ μλ μ«μν μ΄μ΄ μμ΅λλ€.")
|
| 114 |
|
| 115 |
+
# μ¬μ©μκ° μ νν λ λ³μμ λν μ°μ λ λ° νκ· λΆμ
|
| 116 |
+
st.subheader("λ λ³μ κ°μ κ΄κ³ λΆμ")
|
| 117 |
+
numeric_columns = filtered_data.select_dtypes(include=['float64', 'int64']).columns
|
| 118 |
+
x_var = st.selectbox("XμΆ λ³μ μ ν", options=numeric_columns)
|
| 119 |
+
y_var = st.selectbox("YμΆ λ³μ μ ν", options=[col for col in numeric_columns if col != x_var])
|
| 120 |
+
|
| 121 |
+
if x_var and y_var:
|
| 122 |
+
fig = px.scatter(filtered_data, x=x_var, y=y_var, color='λ°' if 'λ°' in filtered_data.columns else None)
|
| 123 |
|
| 124 |
+
# νκ·μ μΆκ°
|
| 125 |
+
x = filtered_data[x_var]
|
| 126 |
+
y = filtered_data[y_var]
|
| 127 |
slope, intercept, r_value, p_value, std_err = stats.linregress(x, y)
|
| 128 |
line_x = np.array([x.min(), x.max()])
|
| 129 |
line_y = slope * line_x + intercept
|
|
|
|
| 131 |
|
| 132 |
r_squared = r_value ** 2
|
| 133 |
fig.update_layout(
|
| 134 |
+
title=f'{x_var}μ {y_var}μ κ΄κ³ (R-squared: {r_squared:.4f})',
|
| 135 |
+
xaxis_title=x_var,
|
| 136 |
+
yaxis_title=y_var,
|
| 137 |
annotations=[
|
| 138 |
dict(
|
| 139 |
x=0.5,
|
|
|
|
| 147 |
)
|
| 148 |
st.plotly_chart(fig)
|
| 149 |
|
| 150 |
+
# μΆκ° ν΅κ³ μ 보
|
| 151 |
+
st.write(f"μκ΄κ³μ: {r_value:.4f}")
|
| 152 |
+
st.write(f"p-value: {p_value:.4f}")
|
| 153 |
+
st.write(f"νμ€ μ€μ°¨: {std_err:.4f}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
|
| 155 |
def main():
|
| 156 |
st.title("μΈν°λν°λΈ EDA ν΄ν·")
|