Spaces:
Sleeping
Sleeping
Update pages/comps_data.py
Browse files- pages/comps_data.py +102 -43
pages/comps_data.py
CHANGED
|
@@ -1,51 +1,110 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
-
# Sample DataFrame
|
| 5 |
data = {
|
| 6 |
-
'
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
}
|
| 10 |
-
df = pd.DataFrame(data)
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
st.subheader('Map')
|
| 16 |
-
st.map(df)
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
|
|
|
|
| 4 |
data = {
|
| 5 |
+
'Address': ['Location_A', 'Location_B', 'Location_C', 'Location_D', 'Location_E',
|
| 6 |
+
'Location_F', 'Location_G', 'Location_H'
|
| 7 |
+
],
|
| 8 |
+
'latitude': np.random.uniform(40.7, 40.8, size=8), # Assuming latitude range between 40.7 and 40.8
|
| 9 |
+
'longitude': np.random.uniform(-74.0, -73.9, size=8), # Assuming longitude range between -74.0 and -73.9
|
| 10 |
+
'Match score': [90, 89, 88, 87, 86, 85, 84, 83],
|
| 11 |
+
'Market': ["M1", "M1", "M1", "M1", "M1", "M1", "M1", "M1"],
|
| 12 |
+
'Sub-market': ["S1", "S1", "S1", "S1", "S1", "S1", "S1", "S1"],
|
| 13 |
+
'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"],
|
| 14 |
+
'LSF': [20000, 30000, 20000, 30000, 20000, 30000, 50000, 35000],
|
| 15 |
+
'RSF': [20000, 30000, 20000, 30000, 20000, 30000, 50000, 35000],
|
| 16 |
+
'Rent (NNN)': [11, 11, 11, 12, 12, 12, 12, 15],
|
| 17 |
+
'Year Built': [2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019],
|
| 18 |
+
'Office %': [20, 20, 20, 20, 20, 20, 20, 20],
|
| 19 |
+
'Clear Height':[19, 18, 19, 18, 17, 19, 19, 18],
|
| 20 |
+
'Doors (drive in / Dock)': [2, 2, 2, 2, 2, 2, 2, 2],
|
| 21 |
+
'Lease Term ': [60, 60, 60, 60, 60, 60, 60, 60],
|
| 22 |
+
'Rent (Gross)': [11, 11, 11, 12, 12, 12, 12, 15],
|
| 23 |
+
'TIs ': [1, 1, 1, 1, 1, 1, 1, 1]
|
| 24 |
}
|
|
|
|
| 25 |
|
| 26 |
+
# Create DataFrame
|
| 27 |
+
df_data = pd.DataFrame(data)
|
| 28 |
+
filtered_data = 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)']]
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
#New property
|
| 31 |
+
# st.write('Target property:')
|
| 32 |
+
# data_new = {
|
| 33 |
+
# 'Address': ['Target property'
|
| 34 |
+
# ],
|
| 35 |
+
# # 'latitude': np.random.uniform(40.7, 40.8, size=1), # Assuming latitude range between 40.7 and 40.8
|
| 36 |
+
# # 'longitude': np.random.uniform(-74.0, -73.9, size=1), # Assuming longitude range between -74.0 and -73.9
|
| 37 |
+
# 'Market': ["M1"],
|
| 38 |
+
# 'Sub-market': ["S1"],
|
| 39 |
+
# 'Lease Date': ["2024/1/1"],
|
| 40 |
+
# 'LSF': [20000],
|
| 41 |
+
# 'RSF': [20000],
|
| 42 |
+
# 'Rent (NNN)': [""],
|
| 43 |
+
# 'Year Built': [2019],
|
| 44 |
+
# 'Office %': [20],
|
| 45 |
+
# 'Clear Height':[18],
|
| 46 |
+
# 'Doors (drive in / Dock)': [2],
|
| 47 |
+
# 'Lease Term ': [""],
|
| 48 |
+
# 'Rent (Gross)': [""],
|
| 49 |
+
# # 'TIs ': []
|
| 50 |
+
# }
|
| 51 |
+
# new_preperty_data = pd.DataFrame(data_new)
|
| 52 |
+
# st.write(new_preperty_data)
|
| 53 |
+
# st.write("")
|
| 54 |
|
| 55 |
+
# Display the filtered data
|
| 56 |
+
col_1_1, col_1_2 = st.columns([2, 1])
|
| 57 |
+
with col_1_1:
|
| 58 |
+
st.write('Comps list:')
|
| 59 |
+
st.write(filtered_data)
|
| 60 |
+
with col_1_2:
|
| 61 |
+
# Create a map object
|
| 62 |
+
m = folium.Map(location=(df_data['latitude'].mean(), df_data['longitude'].mean()), zoom_start=10)
|
| 63 |
+
|
| 64 |
+
# Add markers to the map
|
| 65 |
+
all_markers = folium.FeatureGroup(name='All Markers')
|
| 66 |
+
active_markers = folium.FeatureGroup(name='Active Markers', show=False)
|
| 67 |
+
inactive_markers = folium.FeatureGroup(name='Inactive Markers', show=False)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
for index, row in df_data.iterrows():
|
| 71 |
+
status_color = 'green' if index%2==0 else 'red'
|
| 72 |
+
html_content = f"""
|
| 73 |
+
<div style="
|
| 74 |
+
display: inline-block;
|
| 75 |
+
background-color: white;
|
| 76 |
+
border: 2px solid black;
|
| 77 |
+
border-radius: 50%;
|
| 78 |
+
width: 20px;
|
| 79 |
+
height: 20px;
|
| 80 |
+
text-align: center;
|
| 81 |
+
line-height: 20px;
|
| 82 |
+
font-size: 8pt;
|
| 83 |
+
color: {status_color};
|
| 84 |
+
">{index}</div>
|
| 85 |
+
"""
|
| 86 |
+
|
| 87 |
+
# Create a DivIcon with custom HTML content
|
| 88 |
+
icon = folium.DivIcon(html=html_content)
|
| 89 |
+
marker = folium.Marker([row['latitude'], row['longitude']], popup=row['Address'], icon=icon).add_to(m)
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
# Add layer control to toggle marker visibility
|
| 93 |
+
folium.LayerControl().add_to(m)
|
| 94 |
+
|
| 95 |
+
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)]
|
| 96 |
+
|
| 97 |
+
# Create a polygon object
|
| 98 |
+
polygon = folium.Polygon(locations=polygon_coords, color='blue', fill=True, fill_color='blue', fill_opacity=0.3)
|
| 99 |
+
|
| 100 |
+
# Add the tag to the polygon
|
| 101 |
+
popup_text = "This is my polygon"
|
| 102 |
+
popup = folium.Popup(popup_text, parse_html=True)
|
| 103 |
+
polygon.add_child(popup)
|
| 104 |
+
|
| 105 |
+
# Add the polygon to the map
|
| 106 |
+
m.add_child(polygon)
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
# Render the map
|
| 110 |
+
folium_static(m)
|