Created
September 26, 2017 16:15
-
-
Save sergiolucero/d15071bc3c4b841d516a95ed64c3d752 to your computer and use it in GitHub Desktop.
openAQ air quality
This file contains hidden or 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 openaq | |
| parameters = ['co', 'no2', 'o3', 'pm10', 'pm25', 'so2'] | |
| api = openaq.OpenAQ() | |
| country_list = api.countries(df=True) | |
| print('MONITORING %d locations worldwide' %(country_list.locations.sum())) | |
| for cid, cdata in country_list.iterrows(): | |
| ctry = cdata.name | |
| print('Country %s [code %s] has %d locations' %(ctry, cdata.code, cdata.locations)) | |
| for par in parameters: | |
| locations = api.locations(country=cdata.code, parameter=par, df=True) | |
| for lid, location in locations.iterrows(): | |
| locdata = api.latest(location=location.location, country=cdata.code, df=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment