Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -24,8 +24,7 @@ st.set_page_config(layout="wide")
|
|
24 |
with st.sidebar:
|
25 |
st.header('Welcome to the Airbnb Investment Tool!')
|
26 |
nav = st.selectbox('Navigation', ['Heuristic Pricing',
|
27 |
-
'Investment Analysis'
|
28 |
-
'Customer View'])
|
29 |
|
30 |
#-----------------------------------------
|
31 |
# Additional Functions
|
@@ -137,7 +136,7 @@ def investment_tool(house_price, loan_amount, loan_period, percentage_loan_inter
|
|
137 |
|
138 |
#-----------------------------------------
|
139 |
# Load Airbnb listings data
|
140 |
-
df_raw = pd.read_csv("data/listings_sf_withamenities.csv")
|
141 |
df = df_raw.copy()
|
142 |
gdf = geopandas.GeoDataFrame(
|
143 |
df,
|
@@ -192,8 +191,9 @@ if nav == 'Heuristic Pricing':
|
|
192 |
else:
|
193 |
col3, col4 = st.columns(2)
|
194 |
with col3:
|
195 |
-
df_nearby_stats = gdf_nearby_listings[["price"]].describe()
|
196 |
-
|
|
|
197 |
with col4:
|
198 |
# Plot Stats
|
199 |
fig = plt.figure(figsize=(10, 4))
|
@@ -254,12 +254,4 @@ if nav == 'Investment Analysis':
|
|
254 |
plt.ylabel('Amount')
|
255 |
plt.title('Loan Balance')
|
256 |
plt.legend(('Loan Balance Remaining','Cumulative Principal Paid', 'Cumulative Interest Paid'))
|
257 |
-
st.pyplot(fig)
|
258 |
-
|
259 |
-
if nav == "Customer View":
|
260 |
-
st.markdown("<h3 style='text-align: center; color:grey;'>Airbnb 🏠</h3>", unsafe_allow_html=True)
|
261 |
-
st.text('')
|
262 |
-
p_title('Customer View')
|
263 |
-
|
264 |
-
customer_tableau_embed_code = "<div class='tableauPlaceholder' id='viz1650723513927' style='position: relative'><noscript><a href='#'><img alt=' ' src='https://public.tableau.com/static/images/Da/Dashboard_1_16505589498970/EDA/1_rss.png' style='border: none' /></a></noscript><object class='tableauViz' style='display:none;'><param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' /> <param name='embed_code_version' value='3' /> <param name='site_root' value='' /><param name='name' value='Dashboard_1_16505589498970/EDA' /><param name='tabs' value='yes' /><param name='toolbar' value='yes' /><param name='static_image' value='https://public.tableau.com/static/images/Da/Dashboard_1_16505589498970/EDA/1.png' /> <param name='animate_transition' value='yes' /><param name='display_static_image' value='yes' /><param name='display_spinner' value='yes' /><param name='display_overlay' value='yes' /><param name='display_count' value='yes' /><param name='language' value='en-US' /></object></div> <script type='text/javascript'> var divElement = document.getElementById('viz1650723513927'); var vizElement = divElement.getElementsByTagName('object')[0]; if ( divElement.offsetWidth > 800 ) { vizElement.style.width='1600px';vizElement.style.height='1150px';} else if ( divElement.offsetWidth > 500 ) { vizElement.style.width='1600px';vizElement.style.height='1150px';} else { vizElement.style.width='100%';vizElement.style.height='2850px';} var scriptElement = document.createElement('script'); scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js'; vizElement.parentNode.insertBefore(scriptElement, vizElement); </script>"
|
265 |
-
st.components.v1.html(customer_tableau_embed_code, height=2000, scrolling=True)
|
|
|
24 |
with st.sidebar:
|
25 |
st.header('Welcome to the Airbnb Investment Tool!')
|
26 |
nav = st.selectbox('Navigation', ['Heuristic Pricing',
|
27 |
+
'Investment Analysis'])
|
|
|
28 |
|
29 |
#-----------------------------------------
|
30 |
# Additional Functions
|
|
|
136 |
|
137 |
#-----------------------------------------
|
138 |
# Load Airbnb listings data
|
139 |
+
df_raw = pd.read_csv("/content/drive/MyDrive/NUS Business/DBA4811/Final Project/data/listings_sf_withamenities.csv")
|
140 |
df = df_raw.copy()
|
141 |
gdf = geopandas.GeoDataFrame(
|
142 |
df,
|
|
|
191 |
else:
|
192 |
col3, col4 = st.columns(2)
|
193 |
with col3:
|
194 |
+
df_nearby_stats = gdf_nearby_listings[["price"]].describe().round(2)
|
195 |
+
df_nearby_stats.columns = pd.Index(["value"])
|
196 |
+
st.dataframe(df_nearby_stats.style.format("{:.2f}"))
|
197 |
with col4:
|
198 |
# Plot Stats
|
199 |
fig = plt.figure(figsize=(10, 4))
|
|
|
254 |
plt.ylabel('Amount')
|
255 |
plt.title('Loan Balance')
|
256 |
plt.legend(('Loan Balance Remaining','Cumulative Principal Paid', 'Cumulative Interest Paid'))
|
257 |
+
st.pyplot(fig)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|