Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,6 +19,14 @@ size_map = json.load(open("size_map.json"))
|
|
| 19 |
raw_data = pd.read_csv("./tagged_data.csv")
|
| 20 |
|
| 21 |
def plot_scatter(cat, x, y, col):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
# minimal example
|
| 23 |
pivot_df = grouped_cat.pivot(index='model', columns='tag', values='count').fillna(0).reset_index()
|
| 24 |
|
|
@@ -33,14 +41,6 @@ def plot_scatter(cat, x, y, col):
|
|
| 33 |
color=col,
|
| 34 |
color_continuous_scale="agsunset")
|
| 35 |
|
| 36 |
-
# if cat != "All":
|
| 37 |
-
# data = raw_data[raw_data["Category"] == cat]
|
| 38 |
-
# else:
|
| 39 |
-
# data = raw_data
|
| 40 |
-
# # Group and normalize the data
|
| 41 |
-
# grouped_cat = data.groupby(["model", "tag"]).size().reset_index(name="count").sort_values(by="count", ascending=False)
|
| 42 |
-
# grouped_cat["count"] = grouped_cat.groupby(["model"])["count"].transform(lambda x: x / x.sum())
|
| 43 |
-
|
| 44 |
# # Pivot the data for stacking
|
| 45 |
# pivot_df = grouped_cat.pivot(index='model', columns='tag', values='count').fillna(0)
|
| 46 |
# # pivot_df = pivot_df.sort_values(by="A", ascending=False)
|
|
|
|
| 19 |
raw_data = pd.read_csv("./tagged_data.csv")
|
| 20 |
|
| 21 |
def plot_scatter(cat, x, y, col):
|
| 22 |
+
if cat != "All":
|
| 23 |
+
data = raw_data[raw_data["Category"] == cat]
|
| 24 |
+
else:
|
| 25 |
+
data = raw_data
|
| 26 |
+
# Group and normalize the data
|
| 27 |
+
grouped_cat = data.groupby(["model", "tag"]).size().reset_index(name="count").sort_values(by="count", ascending=False)
|
| 28 |
+
grouped_cat["count"] = grouped_cat.groupby(["model"])["count"].transform(lambda x: x / x.sum())
|
| 29 |
+
|
| 30 |
# minimal example
|
| 31 |
pivot_df = grouped_cat.pivot(index='model', columns='tag', values='count').fillna(0).reset_index()
|
| 32 |
|
|
|
|
| 41 |
color=col,
|
| 42 |
color_continuous_scale="agsunset")
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
# # Pivot the data for stacking
|
| 45 |
# pivot_df = grouped_cat.pivot(index='model', columns='tag', values='count').fillna(0)
|
| 46 |
# # pivot_df = pivot_df.sort_values(by="A", ascending=False)
|