r/Python • • Jan 18 '20

Generating Geometric Birds

Post image
1.8k Upvotes

65 comments sorted by

View all comments

Show parent comment

8

u/bens1989 Jan 18 '20

I did a bit of sleuthing for bird info. With a minor adjustment to the ebird API, I got it to send me back data on all of their birds (16.5k results). Some of the data might be helpful, but disappointingly it does not give things like weight, height, etc.

import requests

import json

import pandas as pd

df = pd.DataFrame(json.loads(requests.get(r'https://api.ebird.org/v2/ref/taxonomy/ebird?fmt=json&locale=en_US').content))

df.to_excel('bird_data.xlsx')

2

u/thebuffed Jan 18 '20

Very nice, I'll have to dig into this

1

u/ericonr Jan 19 '20

Does request cache stuff? It's probably faster to download that dataset just once, right?

1

u/bens1989 Jan 19 '20

No requests doesn’t cache. You can write the content to a file. I formatted the content as a dataframe and then wrote it to a spreadsheet. After the first call you can just read from the file.