Roberta2024
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -93,6 +93,10 @@ if st.button("開始搜索"):
|
|
93 |
if pchome_response.status_code == 200:
|
94 |
pchome_json_data = json.loads(pchome_response.content)
|
95 |
pchome_df = pd.DataFrame(pchome_json_data['prods'])
|
|
|
|
|
|
|
|
|
96 |
pchome_df['platform'] = 'PCHOME' # Add platform identifier
|
97 |
pchome_data = pd.concat([pchome_data, pchome_df])
|
98 |
time.sleep(1)
|
@@ -126,7 +130,7 @@ if st.button("開始搜索"):
|
|
126 |
combined_data = pd.concat([momo_df, pchome_data], ignore_index=True)
|
127 |
|
128 |
# Add a button to download the combined data as CSV
|
129 |
-
csv = combined_data.to_csv(index=False).encode('utf-8-sig')
|
130 |
st.download_button(
|
131 |
label="下載CSV檔案",
|
132 |
data=csv,
|
|
|
93 |
if pchome_response.status_code == 200:
|
94 |
pchome_json_data = json.loads(pchome_response.content)
|
95 |
pchome_df = pd.DataFrame(pchome_json_data['prods'])
|
96 |
+
|
97 |
+
# Select only the required columns: name, describe, price, original price
|
98 |
+
pchome_df = pchome_df[['name', 'describe', 'price', 'orig']]
|
99 |
+
pchome_df = pchome_df.rename(columns={'orig': 'original_price'})
|
100 |
pchome_df['platform'] = 'PCHOME' # Add platform identifier
|
101 |
pchome_data = pd.concat([pchome_data, pchome_df])
|
102 |
time.sleep(1)
|
|
|
130 |
combined_data = pd.concat([momo_df, pchome_data], ignore_index=True)
|
131 |
|
132 |
# Add a button to download the combined data as CSV
|
133 |
+
csv = combined_data.to_csv(index=False, encoding='utf-8-sig').encode('utf-8-sig')
|
134 |
st.download_button(
|
135 |
label="下載CSV檔案",
|
136 |
data=csv,
|