Borya-Goldarb commited on
Commit
a15d0f2
·
verified ·
1 Parent(s): c30de8c

Update pages/comps_data.py

Browse files
Files changed (1) hide show
  1. 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
- 'Name': ['John', 'Alice', 'Bob', 'Emma'],
7
- 'Age': [30, 25, 35, 28],
8
- 'Location': ['New York', 'San Francisco', 'Los Angeles', 'Chicago']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  }
10
- df = pd.DataFrame(data)
11
 
12
- # Function to create the map section
13
- def create_map():
14
- # You can customize this map as per your data
15
- st.subheader('Map')
16
- st.map(df)
17
 
18
- # Function to create the list section with checkboxes
19
- def create_checkbox_list():
20
- st.subheader('List with Checkboxes')
21
- for index, row in df.iterrows():
22
- if st.checkbox(row['Name']):
23
- st.write(row)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- # Function to create the filter section
26
- def create_filters():
27
- st.subheader('Filters')
28
- # Define your filters here, you can use sliders, selectbox, etc.
29
- min_age = st.slider('Minimum Age', min_value=20, max_value=50, value=20)
30
- max_age = st.slider('Maximum Age', min_value=20, max_value=50, value=50)
31
- st.write(f'Filtered Data: Age between {min_age} and {max_age}')
32
- filtered_df = df[(df['Age'] >= min_age) & (df['Age'] <= max_age)]
33
- st.write(filtered_df)
34
-
35
- # Layout
36
- st.title('Streamlit App with Multiple Sections')
37
-
38
- # Section 1 - List in the right top corner
39
- st.subheader('List with Checkboxes (Right Top Corner)')
40
- create_checkbox_list()
41
-
42
- # Section 2 - Map in the left top corner
43
- st.subheader('Map (Left Top Corner)')
44
- create_map()
45
-
46
- # Section 3 - List in the right bottom corner
47
- st.subheader('List with Checkboxes (Right Bottom Corner)')
48
- create_checkbox_list()
49
-
50
- # Section 4 - Filters
51
- create_filters()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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)