ginipick commited on
Commit
1492104
ยท
verified ยท
1 Parent(s): f792c55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -20
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 ํ•ฉ์‚ฐ (์ „์ฒด ID ์‚ฌ์šฉ)
61
  score_sums = top_100_spaces.groupby('id')['trendingScore'].sum()
62
 
63
- # ๋””๋ฒ„๊น…์„ ์œ„ํ•œ ์ถœ๋ ฅ
64
- print("Score sums for each ID:")
65
- for id, total_score in score_sums.sort_values(ascending=False).head(20).items():
66
- print(f"ID: {id}, Total Score: {total_score}")
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
- showgrid=True,
118
- gridwidth=1,
119
- gridcolor='lightgray',
120
- title_text="Space ID"
121
  )
 
122
  fig.update_yaxes(
123
- showgrid=True,
124
- gridwidth=1,
125
- gridcolor='lightgray',
126
- title_text="Rank"
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