-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathm.py
44 lines (32 loc) · 1.07 KB
/
m.py
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
import streamlit as st
import pydeck as pdk
import pandas as pd
import py_data
def app(key, values):
with st.spinner("Preparing map..."):
us_data = py_data.get_data()
lats = us_data['decimalLatitude']
longs = us_data['decimalLongitude']
mask = longs.isna() | lats.isna()
mask = mask | us_data[key].isna()
value_mask = us_data[key].isin(values)
mask = mask | ~value_mask
df = pd.DataFrame()
df['lat'] = lats
df['lon'] = longs
df = df[~mask]
if len(df) == 0:
st.write("No latitude/longitude data found.")
st.map(df)
#TODO Filter out non-US (maybe)
# with st.spinner("Preparing data..."):
# us_data = pd.read_parquet('final_data.parquet')
# st.write(us_data.keys())
# for key in us_data.keys():
# if key == 'verbatimScientificName':
# st.write(us_data[key])
# lats = us_data['decimalLatitude']
# longs = us_data['decimalLongitude']
# mask = longs.isna() | lats.isna()
if __name__ == "__main__":
app(names=[])