Script to fetch and store live pollution data of Indian cities from data.gov.in. The data is updated every hour by data.gov.in. The scipt runs continuous and fetches the data every hour and adds it to a csv file.
- Set
API_KEY
in config.py. This is the data.gov.in API key. - Install requirements using:
conda install --file requirements.txt
- Run the scipt:
python fetch_data.py
The datafile is updated everyday, so the file data_pollution.csv
can be used directly. The datafile contains pollution level
all the available cities from 17-03-2018 07:00:00.
city | country | id | last_update | pollutant_avg | pollutant_id | pollutant_max | pollutant_min | pollutant_unit | state | station | |
---|---|---|---|---|---|---|---|---|---|---|---|
0 | Amaravati | India | 1 | 17-03-2018 07:00:00 | 77 | PM2.5 | 134 | 28 | Andhra_Pradesh | Secretariat, Amaravati - APPCB | |
1 | Amaravati | India | 2 | 17-03-2018 07:00:00 | 74 | PM10 | 106 | 36 | Andhra_Pradesh | Secretariat, Amaravati - APPCB | |
2 | Amaravati | India | 3 | 17-03-2018 07:00:00 | 20 | NO2 | 46 | 9 | Andhra_Pradesh | Secretariat, Amaravati - APPCB | |
3 | Amaravati | India | 4 | 17-03-2018 07:00:00 | 3 | NH3 | 5 | 2 | Andhra_Pradesh | Secretariat, Amaravati - APPCB | |
4 | Amaravati | India | 5 | 17-03-2018 07:00:00 | 15 | SO2 | 60 | 1 | Andhra_Pradesh | Secretariat, Amaravati - APPCB | |
5 | Amaravati | India | 6 | 17-03-2018 07:00:00 | 34 | CO | 41 | 17 | Andhra_Pradesh | Secretariat, Amaravati - APPCB | |
6 | Amaravati | India | 7 | 17-03-2018 07:00:00 | 22 | OZONE | 36 | 4 | Andhra_Pradesh | Secretariat, Amaravati - APPCB | |
7 | Rajamahendravaram | India | 8 | 17-03-2018 07:00:00 | 85 | PM2.5 | 231 | 35 | Andhra_Pradesh | Anand Kala Kshetram, Rajamahendravaram - APPCB | |
8 | Rajamahendravaram | India | 9 | 17-03-2018 07:00:00 | 89 | PM10 | 165 | 41 | Andhra_Pradesh | Anand Kala Kshetram, Rajamahendravaram - APPCB | |
9 | Rajamahendravaram | India | 10 | 17-03-2018 07:00:00 | 34 | NO2 | 56 | 17 | Andhra_Pradesh | Anand Kala Kshetram, Rajamahendravaram - APPCB |