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