Spaces:
Sleeping
Sleeping
Added heatmap app
Browse files- apps/xy.py +22 -2
apps/xy.py
CHANGED
@@ -17,7 +17,9 @@ def app():
|
|
17 |
df = pd.read_csv(url)
|
18 |
|
19 |
columns = df.columns.values.tolist()
|
20 |
-
row1_col1, row1_col2, row1_col3 = st.columns(
|
|
|
|
|
21 |
|
22 |
lon_index = 0
|
23 |
lat_index = 0
|
@@ -37,7 +39,25 @@ def app():
|
|
37 |
with row1_col3:
|
38 |
popups = st.multiselect("Select popup columns", columns, columns)
|
39 |
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
except Exception as e:
|
43 |
st.error(e)
|
|
|
17 |
df = pd.read_csv(url)
|
18 |
|
19 |
columns = df.columns.values.tolist()
|
20 |
+
row1_col1, row1_col2, row1_col3, row1_col4, row1_col5 = st.columns(
|
21 |
+
[1, 1, 3, 1, 1]
|
22 |
+
)
|
23 |
|
24 |
lon_index = 0
|
25 |
lat_index = 0
|
|
|
39 |
with row1_col3:
|
40 |
popups = st.multiselect("Select popup columns", columns, columns)
|
41 |
|
42 |
+
with row1_col4:
|
43 |
+
heatmap = st.checkbox("Add heatmap")
|
44 |
+
|
45 |
+
if heatmap:
|
46 |
+
with row1_col5:
|
47 |
+
if "pop_max" in columns:
|
48 |
+
index = columns.index("pop_max")
|
49 |
+
else:
|
50 |
+
index = 0
|
51 |
+
heatmap_col = st.selectbox("Select heatmap column", columns, index)
|
52 |
+
try:
|
53 |
+
m.add_heatmap(df, y, x, heatmap_col)
|
54 |
+
except:
|
55 |
+
st.error("Please select a numeric column")
|
56 |
+
|
57 |
+
try:
|
58 |
+
m.add_points_from_xy(df, x, y, popups)
|
59 |
+
except:
|
60 |
+
st.error("Please select a numeric column")
|
61 |
|
62 |
except Exception as e:
|
63 |
st.error(e)
|