Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -57,13 +57,13 @@ def create_trend_chart(space_id, daily_ranks_df):
|
|
57 |
return None
|
58 |
|
59 |
def get_duplicate_spaces(top_100_spaces):
|
60 |
-
# ID๋ณ trending score ํฉ์ฐ
|
61 |
score_sums = top_100_spaces.groupby('id')['trendingScore'].sum()
|
62 |
|
63 |
-
#
|
64 |
-
print("
|
65 |
-
for id,
|
66 |
-
print(f"
|
67 |
|
68 |
# ํฉ์ฐ๋ ์ค์ฝ์ด๋ก ์ ๋ ฌํ์ฌ ์์ 20๊ฐ ์ ํ
|
69 |
top_20_scores = score_sums.sort_values(ascending=False).head(20)
|
@@ -80,16 +80,11 @@ def create_duplicates_chart(score_sums):
|
|
80 |
'rank': range(1, len(score_sums) + 1)
|
81 |
})
|
82 |
|
83 |
-
# ๋๋ฒ๊น
์ ์ํ ์ถ๋ ฅ
|
84 |
-
print("\nFinal chart data:")
|
85 |
-
print(df)
|
86 |
-
|
87 |
fig = px.bar(
|
88 |
df,
|
89 |
-
x='id',
|
90 |
y='rank',
|
91 |
title="Top 20 Spaces by Combined Trending Score",
|
92 |
-
labels={'id': 'Space ID', 'rank': 'Rank'},
|
93 |
height=400
|
94 |
)
|
95 |
|
@@ -100,7 +95,7 @@ def create_duplicates_chart(score_sums):
|
|
100 |
paper_bgcolor='white',
|
101 |
xaxis_tickangle=-45,
|
102 |
yaxis=dict(
|
103 |
-
range=[20.5, 0.5],
|
104 |
tickmode='linear',
|
105 |
tick0=1,
|
106 |
dtick=1
|
@@ -113,17 +108,19 @@ def create_duplicates_chart(score_sums):
|
|
113 |
customdata=df['total_score']
|
114 |
)
|
115 |
|
|
|
116 |
fig.update_xaxes(
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
)
|
|
|
122 |
fig.update_yaxes(
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
)
|
128 |
|
129 |
return fig
|
|
|
57 |
return None
|
58 |
|
59 |
def get_duplicate_spaces(top_100_spaces):
|
60 |
+
# ID๋ณ trending score ํฉ์ฐ
|
61 |
score_sums = top_100_spaces.groupby('id')['trendingScore'].sum()
|
62 |
|
63 |
+
# ๋๋ฒ๊น
์ฉ ์ถ๋ ฅ
|
64 |
+
print("\nID๋ณ ํฉ์ฐ ์ค์ฝ์ด:")
|
65 |
+
for id, score in score_sums.sort_values(ascending=False).head(20).items():
|
66 |
+
print(f"{id}: {score}")
|
67 |
|
68 |
# ํฉ์ฐ๋ ์ค์ฝ์ด๋ก ์ ๋ ฌํ์ฌ ์์ 20๊ฐ ์ ํ
|
69 |
top_20_scores = score_sums.sort_values(ascending=False).head(20)
|
|
|
80 |
'rank': range(1, len(score_sums) + 1)
|
81 |
})
|
82 |
|
|
|
|
|
|
|
|
|
83 |
fig = px.bar(
|
84 |
df,
|
85 |
+
x='id', # ID๋ง ํ์
|
86 |
y='rank',
|
87 |
title="Top 20 Spaces by Combined Trending Score",
|
|
|
88 |
height=400
|
89 |
)
|
90 |
|
|
|
95 |
paper_bgcolor='white',
|
96 |
xaxis_tickangle=-45,
|
97 |
yaxis=dict(
|
98 |
+
range=[20.5, 0.5], # ์์ 1์ด ์์ชฝ์ ์ค๋๋ก
|
99 |
tickmode='linear',
|
100 |
tick0=1,
|
101 |
dtick=1
|
|
|
108 |
customdata=df['total_score']
|
109 |
)
|
110 |
|
111 |
+
# x์ถ ๋ ์ด๋ธ์ ID๋ง ํ์ํ๋๋ก ์ค์
|
112 |
fig.update_xaxes(
|
113 |
+
title_text="Space ID",
|
114 |
+
showgrid=True,
|
115 |
+
gridwidth=1,
|
116 |
+
gridcolor='lightgray'
|
117 |
)
|
118 |
+
|
119 |
fig.update_yaxes(
|
120 |
+
title_text="Rank",
|
121 |
+
showgrid=True,
|
122 |
+
gridwidth=1,
|
123 |
+
gridcolor='lightgray'
|
124 |
)
|
125 |
|
126 |
return fig
|