Created
September 4, 2018 02:46
-
-
Save gajomi/49310ed275433701642d4b8e552d38c4 to your computer and use it in GitHub Desktop.
seattle blackberry observations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request, json | |
import pandas as pd | |
urlstr = "https://api.inaturalist.org/v1/observations?captive=false&taxon_name=Rubus&year=2018&lat=47.6&lng=-122.3&radius=50&order=desc&order_by=created_at" | |
with urllib.request.urlopen(urlstr) as url: | |
data = json.loads(url.read().decode()) | |
def parse_observation(observation): | |
data = {} | |
data['species'] = observation['taxon']['name'] | |
for dateval in ['day','week','month','year']: | |
data[dateval] = observation['observed_on_details'][dateval] | |
data['firstusername'] = observation['identifications'][0]['user']['login'] | |
return data | |
df = pd.DataFrame([parse_observation(row) for row in data['results']]) | |
print(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index | day | firstusername | month | species | week | year | |
---|---|---|---|---|---|---|---|
0 | 3 | cheerwine | 9 | Rubus armeniacus | 36 | 2018 | |
1 | 3 | esiliaarcher | 9 | Rubus fruticosus | 36 | 2018 | |
2 | 3 | allendenver | 9 | Rubus ursinus | 36 | 2018 | |
3 | 3 | joshuamorris | 9 | Rubus laciniatus | 36 | 2018 | |
4 | 3 | joshuamorris | 9 | Rubus parviflorus | 36 | 2018 | |
5 | 3 | joshuamorris | 9 | Rubus laciniatus | 36 | 2018 | |
6 | 1 | hboyce | 9 | Rubus armeniacus | 35 | 2018 | |
7 | 1 | hboyce | 9 | Rubus laciniatus | 35 | 2018 | |
8 | 1 | mlindgren | 9 | Rubus armeniacus | 35 | 2018 | |
9 | 1 | mlindgren | 9 | Rubus armeniacus | 35 | 2018 | |
10 | 31 | cheerwine | 8 | Rubus laciniatus | 35 | 2018 | |
11 | 30 | marcjohns | 8 | Rubus armeniacus | 35 | 2018 | |
12 | 30 | cheerwine | 8 | Rubus armeniacus | 35 | 2018 | |
13 | 29 | rita73 | 8 | Rubus parviflorus | 35 | 2018 | |
14 | 29 | liberdade24 | 8 | Rubus ursinus | 35 | 2018 | |
15 | 29 | cheerwine | 8 | Rubus ursinus | 35 | 2018 | |
16 | 28 | liberdade24 | 8 | Rubus spectabilis | 35 | 2018 | |
17 | 27 | jamigramore | 8 | Rubus ursinus | 35 | 2018 | |
18 | 24 | spacecowboy | 8 | Rubus ursinus | 34 | 2018 | |
19 | 24 | spacecowboy | 8 | Rubus | 34 | 2018 | |
20 | 24 | spacecowboy | 8 | Rubus ursinus | 34 | 2018 | |
21 | 26 | brendandan | 8 | Rubus | 34 | 2018 | |
22 | 24 | schylerbrown | 8 | Rubus parviflorus | 34 | 2018 | |
23 | 24 | schylerbrown | 8 | Rubus | 34 | 2018 | |
24 | 23 | georgina15 | 8 | Rubus | 34 | 2018 | |
25 | 23 | georgina15 | 8 | Rubus ursinus | 34 | 2018 | |
26 | 21 | hawke | 8 | Rubus laciniatus | 34 | 2018 | |
27 | 11 | natwarning | 8 | Rubus pedatus | 32 | 2018 | |
28 | 17 | xiebob | 8 | Rubus laciniatus | 33 | 2018 | |
29 | 18 | schylerbrown | 8 | Rubus spectabilis | 33 | 2018 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment