Borya-Goldarb commited on
Commit
e0773a3
·
verified ·
1 Parent(s): fbb1046

Create comps_data.py

Browse files
Files changed (1) hide show
  1. pages/comps_data.py +54 -0
pages/comps_data.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Define layout columns
39
+ left_column, right_column = st.beta_columns(2)
40
+
41
+ # Section 1 - List in the right top corner
42
+ with right_column:
43
+ create_checkbox_list()
44
+
45
+ # Section 2 - Map in the left top corner
46
+ with left_column:
47
+ create_map()
48
+
49
+ # Section 3 - List in the right bottom corner
50
+ with right_column:
51
+ create_checkbox_list()
52
+
53
+ # Section 4 - Filters
54
+ create_filters()