Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,6 @@ urls = urls_df['網址'].tolist()
|
|
17 |
# 初始化一個空的 DataFrame 列表來儲存所有資料
|
18 |
df_list = []
|
19 |
|
20 |
-
|
21 |
# 迭代每個網址並抓取資料
|
22 |
for url in urls:
|
23 |
response = requests.get(url)
|
@@ -36,7 +35,9 @@ for url in urls:
|
|
36 |
description_tag = soup.find('div', class_='restaurant-details__description--text')
|
37 |
description = description_tag.text.strip() if description_tag else 'N/A'
|
38 |
|
39 |
-
|
|
|
|
|
40 |
|
41 |
# 將抓取的資料新增到列表中
|
42 |
df_list.append({
|
@@ -72,4 +73,4 @@ fig_pie.update_layout(title='每個區的商家數量比例')
|
|
72 |
|
73 |
# 按鈕來顯示圓餅圖
|
74 |
if st.button('顯示每個區的商家數量比例圓餅圖'):
|
75 |
-
st.plotly_chart(fig_pie)
|
|
|
17 |
# 初始化一個空的 DataFrame 列表來儲存所有資料
|
18 |
df_list = []
|
19 |
|
|
|
20 |
# 迭代每個網址並抓取資料
|
21 |
for url in urls:
|
22 |
response = requests.get(url)
|
|
|
35 |
description_tag = soup.find('div', class_='restaurant-details__description--text')
|
36 |
description = description_tag.text.strip() if description_tag else 'N/A'
|
37 |
|
38 |
+
# NOTE: Assuming latitude and longitude are not available from the current page content, you can omit them or fetch them if necessary
|
39 |
+
lat = 'N/A'
|
40 |
+
lon = 'N/A'
|
41 |
|
42 |
# 將抓取的資料新增到列表中
|
43 |
df_list.append({
|
|
|
73 |
|
74 |
# 按鈕來顯示圓餅圖
|
75 |
if st.button('顯示每個區的商家數量比例圓餅圖'):
|
76 |
+
st.plotly_chart(fig_pie)
|