Update app.py
Browse files
app.py
CHANGED
@@ -37,18 +37,22 @@ def main():
|
|
37 |
"인구밀집도": population_df
|
38 |
}
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
52 |
|
53 |
if __name__ == "__main__":
|
54 |
-
main()
|
|
|
|
|
|
37 |
"인구밀집도": population_df
|
38 |
}
|
39 |
|
40 |
+
# Check if any dataset is selected
|
41 |
+
if datasets:
|
42 |
+
combined_data = pd.concat([dataset_mapping[dataset_name] for dataset_name in datasets])
|
43 |
+
|
44 |
+
fig, ax = plt.subplots(figsize=(8, 8))
|
45 |
+
|
46 |
+
centroids, labels = apply_kmeans(combined_data.values, k_value)
|
47 |
+
ax.scatter(combined_data['x'], combined_data['y'], c=labels, cmap='viridis')
|
48 |
+
ax.scatter(centroids[:, 0], centroids[:, 1], s=200, c='red', marker='X')
|
49 |
+
|
50 |
+
ax.set_xlim(0, 100)
|
51 |
+
ax.set_ylim(0, 100)
|
52 |
+
ax.set_title(f"K-means clustering result (k={k_value})")
|
53 |
+
st.pyplot(fig)
|
54 |
|
55 |
if __name__ == "__main__":
|
56 |
+
main()
|
57 |
+
|
58 |
+
|