Spaces:
Runtime error
Runtime error
Initial commit
Browse files- .gitattributes +1 -0
- app.py +84 -0
- data.csv +3 -0
- requirements.txt +4 -0
.gitattributes
CHANGED
@@ -29,3 +29,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.csv filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
st.set_page_config(layout="wide")
|
3 |
+
import pandas as pd
|
4 |
+
import plotly.express as px
|
5 |
+
|
6 |
+
# titles
|
7 |
+
|
8 |
+
st.sidebar.markdown("## HDB Resale Prices")
|
9 |
+
st.sidebar.markdown("Flat Options")
|
10 |
+
|
11 |
+
# read data
|
12 |
+
|
13 |
+
@st.cache
|
14 |
+
def load_data():
|
15 |
+
return pd.read_csv("data.csv")
|
16 |
+
|
17 |
+
df = load_data()
|
18 |
+
|
19 |
+
# setup UI
|
20 |
+
|
21 |
+
town_options = list(df["town"].unique())
|
22 |
+
town_options.sort()
|
23 |
+
town_options = ["ALL"] + town_options
|
24 |
+
town = st.sidebar.selectbox(label="Town",
|
25 |
+
options=town_options)
|
26 |
+
|
27 |
+
if town != "ALL":
|
28 |
+
df = df[df['town']==town]
|
29 |
+
|
30 |
+
flat_type_options = list(df["flat_type"].unique())
|
31 |
+
flat_type_options.sort()
|
32 |
+
flat_type_options = ["ALL"] + flat_type_options
|
33 |
+
flat_type = st.sidebar.selectbox(label="Flat Type",
|
34 |
+
options=flat_type_options)
|
35 |
+
|
36 |
+
if flat_type != "ALL":
|
37 |
+
df = df[df['flat_type']==flat_type]
|
38 |
+
|
39 |
+
flat_model_options = list(df["flat_model"].unique())
|
40 |
+
flat_model_options.sort()
|
41 |
+
flat_model_options = ["ALL"] + flat_model_options
|
42 |
+
flat_model = st.sidebar.selectbox(label="Flat Model",
|
43 |
+
options=flat_model_options)
|
44 |
+
|
45 |
+
if flat_model != "ALL":
|
46 |
+
df = df[df['flat_model']==flat_model]
|
47 |
+
|
48 |
+
storey_options = list(df["storey_range"].unique())
|
49 |
+
storey_options.sort()
|
50 |
+
storey_options = ["ALL"] + storey_options
|
51 |
+
storey_range = st.sidebar.selectbox(label="Storey Range",
|
52 |
+
options=storey_options)
|
53 |
+
|
54 |
+
if storey_range != "ALL":
|
55 |
+
df = df[df['storey_range']==storey_range]
|
56 |
+
|
57 |
+
floor_area_options = list(df["floor_area_sqm"].unique())
|
58 |
+
floor_area_options.sort()
|
59 |
+
floor_area_options = ["ALL"] + floor_area_options
|
60 |
+
floor_area = st.sidebar.selectbox(label="Floor Area",
|
61 |
+
options=floor_area_options)
|
62 |
+
|
63 |
+
if floor_area != "ALL":
|
64 |
+
df = df[df['floor_area_sqm']==floor_area]
|
65 |
+
|
66 |
+
#df = df.drop(labels=["town", "flat_type", "storey_range", "floor_area_sqm"], axis="columns")
|
67 |
+
|
68 |
+
df = df.drop(labels=["town", ], axis="columns")
|
69 |
+
|
70 |
+
df = df.sort_values(by="month", ascending=False)
|
71 |
+
#df["floor_area_sqm"] = df["floor_area_sqm"].astype("int")
|
72 |
+
df["resale_price"] = df["resale_price"].astype("int")
|
73 |
+
|
74 |
+
st.markdown("### Selected Data")
|
75 |
+
|
76 |
+
st.dataframe(data=df)
|
77 |
+
|
78 |
+
st.markdown("### Visualization of Selected Data")
|
79 |
+
|
80 |
+
fig = px.box(df,
|
81 |
+
x="month", y="resale_price",
|
82 |
+
title='Resale Price over time')
|
83 |
+
|
84 |
+
st.plotly_chart(fig, use_container_width=True)
|
data.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:795f6fbb98a7edbc9bd644b095fe74d0a7d8c89dd1f95fdb3996b8490b291ec0
|
3 |
+
size 13309175
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
pandas
|
3 |
+
plotly
|
4 |
+
|