RKoops/intermediate_python_for_data_science
0
1import os2import shutil3 4import gdown5import pandas as pd6import plotly.express as px7import streamlit as st8 9 10@st.cache11def get_data():12 # Download file from Google Drive13 # This file is based on data from: http://insideairbnb.com/get-the-data/14 file_id_1 = "1KTF77Sj0kWyft9gNT3_6k84gauPA95rG"15 downloaded_file_1 = "listings.pkl"16 gdown.download(id=file_id_1, output=downloaded_file_1)17 18 # Read a Python Pickle file19 return pd.read_pickle("listings.pkl")20 21 22df = get_data()23 24 25st.title("The Airbnb dataset of Amsterdam")26st.markdown(27 "The dataset contains slight modifications with regards to the original for illustrative purposes"28)29st.dataframe(df.head(100))30st.text("The dataset was retrieved using the following code:")31st.code(32 """33@st.cache34def get_data():35 # Download file from Google Drive36 # This file is based on data from: http://insideairbnb.com/get-the-data/37 file_id_1 = "1KTF77Sj0kWyft9gNT3_6k84gauPA95rG"38 downloaded_file_1 = "listings.pkl"39 gdown.download(id=file_id_1, output=downloaded_file_1)40 41 # Read a Python Pickle file42 return pd.read_pickle("listings.pkl")43""",44 language="python",45)46st.markdown(47 "*Let's take a closer look at the supposed relation between **price_in_dollar** and **review_scores_rating**.*"48)49st.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)58 