Spaces:
Sleeping
Sleeping
Final Commit
Browse files
app.py
CHANGED
|
@@ -2,8 +2,9 @@ import pandas as pd
|
|
| 2 |
import streamlit as st
|
| 3 |
import altair as alt
|
| 4 |
|
| 5 |
-
|
| 6 |
import streamlit.components.v1 as components
|
|
|
|
| 7 |
|
| 8 |
components.html(
|
| 9 |
"""
|
|
@@ -11,7 +12,7 @@ components.html(
|
|
| 11 |
document.querySelector('iframe').style.height = '100vh';
|
| 12 |
</script>
|
| 13 |
""",
|
| 14 |
-
height=0,
|
| 15 |
)
|
| 16 |
|
| 17 |
|
|
@@ -28,17 +29,13 @@ st.markdown(
|
|
| 28 |
)
|
| 29 |
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
# Load and clean dataset
|
| 34 |
url = "https://raw.githubusercontent.com/UIUC-iSchool-DataViz/is445_data/main/building_inventory.csv"
|
| 35 |
df = pd.read_csv(url, na_values={'Year Acquired': 0, 'Year Constructed': 0, 'Square Footage': 0})
|
| 36 |
-
# st.set_page_config(page_title="Building Inventory Analysis", layout="wide")
|
| 37 |
-
|
| 38 |
|
| 39 |
|
| 40 |
# Displaying the Dataset Overview
|
| 41 |
-
st.header("Dataset
|
| 42 |
st.write("Below are the first 10 rows of the dataset:")
|
| 43 |
st.write(df.head(10))
|
| 44 |
st.write(f"The shape of dataset before cleaning is: {df.shape}")
|
|
@@ -60,9 +57,9 @@ df = df.dropna(subset=['Year Acquired', 'Year Constructed'])
|
|
| 60 |
df['County'] = df['County'].fillna('Unknown')
|
| 61 |
df['Square Footage'] = df['Square Footage'].fillna(df['Square Footage'].mean())
|
| 62 |
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
|
| 67 |
|
| 68 |
# Visualization 1: Number of Buildings by County and Agency
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
import altair as alt
|
| 4 |
|
| 5 |
+
|
| 6 |
import streamlit.components.v1 as components
|
| 7 |
+
st.set_page_config(page_title="Building Inventory Analysis", layout="wide")
|
| 8 |
|
| 9 |
components.html(
|
| 10 |
"""
|
|
|
|
| 12 |
document.querySelector('iframe').style.height = '100vh';
|
| 13 |
</script>
|
| 14 |
""",
|
| 15 |
+
height=0,
|
| 16 |
)
|
| 17 |
|
| 18 |
|
|
|
|
| 29 |
)
|
| 30 |
|
| 31 |
|
|
|
|
|
|
|
| 32 |
# Load and clean dataset
|
| 33 |
url = "https://raw.githubusercontent.com/UIUC-iSchool-DataViz/is445_data/main/building_inventory.csv"
|
| 34 |
df = pd.read_csv(url, na_values={'Year Acquired': 0, 'Year Constructed': 0, 'Square Footage': 0})
|
|
|
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
# Displaying the Dataset Overview
|
| 38 |
+
st.header("Building Inventory Dataset Analysis")
|
| 39 |
st.write("Below are the first 10 rows of the dataset:")
|
| 40 |
st.write(df.head(10))
|
| 41 |
st.write(f"The shape of dataset before cleaning is: {df.shape}")
|
|
|
|
| 57 |
df['County'] = df['County'].fillna('Unknown')
|
| 58 |
df['Square Footage'] = df['Square Footage'].fillna(df['Square Footage'].mean())
|
| 59 |
|
| 60 |
+
st.subheader("Missing Values After Cleaning")
|
| 61 |
+
st.write(df.isnull().sum())
|
| 62 |
+
st.write(f"The shape of dataset after cleaning is: {df.shape}")
|
| 63 |
|
| 64 |
|
| 65 |
# Visualization 1: Number of Buildings by County and Agency
|