Spaces:
Sleeping
Sleeping
File size: 8,519 Bytes
e0773a3 e3c304e f4fed09 82bb501 a15d0f2 60ad1a5 468f039 60ad1a5 a15d0f2 60ad1a5 a15d0f2 4ec44ba a15d0f2 60ad1a5 432fd75 a15d0f2 60ad1a5 d22edd1 60ad1a5 a15d0f2 60ad1a5 82bb501 60ad1a5 c1290c6 82bb501 a6019ab c1290c6 60ad1a5 a6019ab c1f3593 ccebf6b c1f3593 68a6ca4 196ea3f 4ec44ba c95c50f 68a6ca4 c95c50f 4afcaf7 07fa3bf 793116e 07fa3bf 4ec44ba 793116e 07fa3bf c1f3593 782197f 3c1b26f 89034bb 5c769cf 711d15a 38f3c03 4574563 468f039 60ad1a5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
import streamlit as st
import pandas as pd
from streamlit_folium import folium_static
import numpy as np
import folium
import matplotlib.pyplot as plt
import seaborn as sns
from datetime import datetime, timedelta
def main():
st.set_page_config(initial_sidebar_state="collapsed", layout="wide")
data = {
"favorite": [True, False, False, True, True, False, False, True],
'Address': ['Location_A', 'Location_B', 'Location_C', 'Location_D', 'Location_E',
'Location_F', 'Location_G', 'Location_H'
],
'latitude': np.random.uniform(40.7, 40.8, size=8), # Assuming latitude range between 40.7 and 40.8
'longitude': np.random.uniform(-74.0, -73.9, size=8), # Assuming longitude range between -74.0 and -73.9
'Match score': [90, 89, 88, 87, 86, 85, 84, 83],
'Market': ["M1", "M1", "M1", "M1", "M1", "M1", "M1", "M1"],
'Sub-market': ["S1", "S1", "S1", "S1", "S1", "S1", "S1", "S1"],
'Lease Date': ["2024/1/1", "2024/1/1", "2024/1/1", "2024/1/1", "2024/1/1", "2024/1/1", "2024/1/1", "2024/1/1"],
'LSF': [20000, 30000, 20000, 30000, 20000, 30000, 50000, 35000],
'RSF': [20000, 30000, 20000, 30000, 20000, 30000, 50000, 35000],
'Rent (NNN)': [11, 11, 11, 12, 12, 12, 12, 15],
'Year Built': [2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019],
'Office %': [20, 20, 20, 20, 20, 20, 20, 20],
'Clear Height':[19, 18, 19, 18, 17, 19, 19, 18],
'Doors (drive in / Dock)': [2, 2, 2, 2, 2, 2, 2, 2],
'Lease Term ': [60, 60, 60, 60, 60, 60, 60, 60],
'Rent (Gross)': [11, 11, 11, 12, 12, 12, 12, 15],
'TIs ': [1, 1, 1, 1, 1, 1, 1, 1]
}
# Create DataFrame
df_data = pd.DataFrame(data)
# df_data_checkbox = df_data.copy()
# df_data_checkbox.insert(loc=0, column='Select rows', value=[False]*len(df_data))
filtered_data2 = df_data[['Address', 'Market', 'Sub-market', 'Lease Date', 'LSF', 'RSF', 'Rent (NNN)', 'Year Built', 'Office %', 'Clear Height', 'Doors (drive in / Dock)', 'Lease Term ', 'Rent (Gross)']]
filtered_data = pd.concat([filtered_data2])
# Display the filtered data
col_1_1, col_1_2 = st.columns([2, 1])
with col_1_1:
st.write('Comps list:')
display_df = st.table(filtered_data)
with col_1_2:
# Create a map object
m = folium.Map(width=500, height=440, location=(df_data['latitude'].mean(), df_data['longitude'].mean()), zoom_start=10)
# Add markers to the map
all_markers = folium.FeatureGroup(name='All Markers')
active_markers = folium.FeatureGroup(name='Active Markers', show=False)
inactive_markers = folium.FeatureGroup(name='Inactive Markers', show=False)
for index, row in df_data.iterrows():
status_color = 'green' if index%2==0 else 'red'
html_content = f"""
<div style="
display: inline-block;
background-color: white;
border: 2px solid black;
border-radius: 50%;
width: 20px;
height: 20px;
text-align: center;
line-height: 20px;
font-size: 8pt;
color: {status_color};
">{index}</div>
"""
# Create a DivIcon with custom HTML content
icon = folium.DivIcon(html=html_content)
marker = folium.Marker([row['latitude'], row['longitude']], popup=row['Address'], icon=icon).add_to(m)
# Add layer control to toggle marker visibility
folium.LayerControl().add_to(m)
polygon_coords = [ [np.random.uniform(40.7, 40.8, size=6)[i], np.random.uniform(-74.0, -73.9, size=6)[i]] for i in range(6)]
# Create a polygon object
polygon = folium.Polygon(locations=polygon_coords, color='blue', fill=True, fill_color='blue', fill_opacity=0.3)
# Add the tag to the polygon
popup_text = "This is my polygon"
popup = folium.Popup(popup_text, parse_html=True)
polygon.add_child(popup)
# Add the polygon to the map
m.add_child(polygon)
# Render the map
folium_static(m)
col_2_1, col_2_2, col_2_3 = st.columns([4, 4, 1])
with col_2_1:
option = st.radio("Add comps:", (":rainbow[On]", ":rainbow[Off]"), horizontal=True, index=1)
with col_2_2:
if st.button("Predictions"):
st.switch_page("pages/market_rent_estimation.py")
with col_2_3:
if st.button("Rexy"):
st.switch_page("pages/rexy.py")
if option == ":rainbow[On]":
col_3_1, col_3_2, col_3_3 = st.columns([5,1,5])
with col_3_1:
data5 = {
"favorite": [False]*8,
'Address': ['B', 'B', 'B', 'B', 'B', 'B', 'B', 'B'],
'latitude': [40.7]*8, # Assuming latitude range between 40.7 and 40.8
'longitude': [-74.0]*8, # Assuming longitude range between -74.0 and -73.9
'Match score': [12, 12, 12, 12, 12, 12, 12, 12],
'Market': ["M2", "M2", "M2", "M2", "M2", "M2", "M2", "M2"],
'Sub-market': ["S2", "S2", "S2", "S2", "S2", "S2", "S2", "S2"],
'Lease Date': ["2024/1/1", "2024/1/1", "2024/1/1", "2024/1/1", "2024/1/1", "2024/1/1", "2024/1/1", "2024/1/1"],
'LSF': [20000, 30000, 20000, 30000, 20000, 30000, 50000, 35000],
'RSF': [20000, 30000, 20000, 30000, 20000, 30000, 50000, 35000],
'Rent (NNN)': [11, 11, 11, 12, 12, 12, 12, 15],
'Year Built': [2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019],
'Office %': [20, 20, 20, 20, 20, 20, 20, 20],
'Clear Height':[19, 18, 19, 18, 17, 19, 19, 18],
'Doors (drive in / Dock)': [2, 2, 2, 2, 2, 2, 2, 2],
'Lease Term ': [60, 60, 60, 60, 60, 60, 60, 60],
'Rent (Gross)': [11, 11, 11, 12, 12, 12, 12, 15],
'TIs ': [1, 1, 1, 1, 1, 1, 1, 1]
}
# Create DataFrame
df5 = pd.DataFrame(data5)
# df5.insert(loc=0, column='Select rows', value=[False]*len(df5))
st.write('Additional comps')
test = st.data_editor(
df5,
column_config={
"favorite": st.column_config.CheckboxColumn(
"Your favorite?",
help="Select your **favorite** widgets",
default=False,
)
},
disabled=['Address','latitude','longitude','Match score','Market','Sub-market','Lease Date','LSF',
'RSF','Rent (NNN)','Year Built','Office %','Clear Height','Doors (drive in / Dock)','Lease Term ','Rent (Gross)','TIs '],
hide_index=True,
)
with col_3_2:
if st.button("Add comps", help="Click to add more comps"):
filtered_data1 = pd.concat([filtered_data, test.drop(columns=['favorite'])])
# filtered_data.update(test.drop(columns=['favorite']))
display_df.table(filtered_data1)
with col_3_3:
st.write('Filter definition')
range_1 = st.slider('Lease date', min_value=0, max_value=36,
value=(12))
range_2 = st.slider('Location in mi', min_value=0, max_value=50,
value=(12))
range_3 = st.slider('LSF', min_value=0, max_value=500000, step = 1000,
value=(20000, 200000))
range_4 = st.slider('Clear height', min_value=0, max_value=50,
value=(15, 30))
range_5 = st.slider('Year built', min_value=1960, max_value=2024,
value=(1999, 2010))
range_5 = st.slider('Far %', min_value=0, max_value=100,
value=50)
range_6 = st.slider('Office %', min_value=0, max_value=100,
value=30)
range_7 = st.slider('Docl doors & Drive-in', min_value=0, max_value=20,
value=3)
st.button("Apply filter", key="submit_button", help="Click to submit")
if __name__ == "__main__":
main() |