Upload 2 files
Browse files- app.py +57 -0
- requirements.txt +5 -0
app.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
|
| 4 |
+
import gdown
|
| 5 |
+
import pandas as pd
|
| 6 |
+
import plotly.express as px
|
| 7 |
+
import streamlit as st
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
@st.cache
|
| 11 |
+
def get_data():
|
| 12 |
+
# Download file from Google Drive
|
| 13 |
+
# This file is based on data from: http://insideairbnb.com/get-the-data/
|
| 14 |
+
file_id_1 = "1rsxDntx9CRSyDMy_fLHEI5Np4lB153sa"
|
| 15 |
+
downloaded_file_1 = "listings.pkl"
|
| 16 |
+
gdown.download(id=file_id_1, output=downloaded_file_1)
|
| 17 |
+
|
| 18 |
+
# Read a Python Pickle file
|
| 19 |
+
return pd.read_pickle("listings.pkl")
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
df = get_data()
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
st.title("The Airbnb dataset of Amsterdam")
|
| 26 |
+
st.markdown(
|
| 27 |
+
"The dataset contains slight modifications with regards to the original for illustrative purposes"
|
| 28 |
+
)
|
| 29 |
+
st.dataframe(df.head(100))
|
| 30 |
+
st.text("The dataset was retrieved using the following code:")
|
| 31 |
+
st.code(
|
| 32 |
+
"""
|
| 33 |
+
@st.cache
|
| 34 |
+
def get_data():
|
| 35 |
+
# Download file from Google Drive
|
| 36 |
+
# This file is based on data from: http://insideairbnb.com/get-the-data/
|
| 37 |
+
file_id_1 = "1f6o9IeaieH_xXyghjnREfl2dC44pIUc4"
|
| 38 |
+
downloaded_file_1 = "listings.pkl"
|
| 39 |
+
gdown.download(id=file_id_1, output=downloaded_file_1)
|
| 40 |
+
|
| 41 |
+
# Read a Python Pickle file
|
| 42 |
+
return pd.read_pickle("listings.pkl")
|
| 43 |
+
""",
|
| 44 |
+
language="python",
|
| 45 |
+
)
|
| 46 |
+
st.markdown(
|
| 47 |
+
"*Let's take a closer look at the supposed relation between **price_in_dollar** and **review_scores_rating**.*"
|
| 48 |
+
)
|
| 49 |
+
st.plotly_chart(
|
| 50 |
+
px.scatter(
|
| 51 |
+
df,
|
| 52 |
+
x="price_in_dollar",
|
| 53 |
+
y="review_scores_rating",
|
| 54 |
+
trendline="ols",
|
| 55 |
+
trendline_color_override="orange",
|
| 56 |
+
)
|
| 57 |
+
)
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pandas
|
| 2 |
+
streamlit
|
| 3 |
+
plotly
|
| 4 |
+
gdown
|
| 5 |
+
statsmodels
|