Skip to content
No description, website, or topics provided.
Python
Branch: master
Clone or download
Latest commit 9b8e55f May 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cityair_api now printing shape of output df comes with deviceId or stationIn May 23, 2019
MANIFEST added to PyPI Apr 7, 2019
README.rst minor fix May 23, 2019
requirements.txt minor fix May 23, 2019
setup.py minor fix May 23, 2019

README.rst

Inroduction

python package for getting CityAir.io data in a format of Pandas Dataframes for further proccessing. enjoy and feel free to leave a feedback at feedback@cityair.ru

Installing

the last available version is 0.1.*. You can install or upgrade the stable cityair-api version with:

$ pip install cityair-api -U

Example

first you need to init the CityAirRequest object passing your login and password:

from cityair_api import CityAirRequest

r = CityAirRequest('CityAir_demo', 'cityAirDemoPassword231')

Getting data from stations

We highly recommend to use stations API. First you may want to get the stations list available to you:

stations = r.get_stations()

then you can get the data collected by the stations. Important arguments are:

  • start_date, finish_date - may be in datetime or string formats
  • period is time resolution and may be '5min', '20min', '1hr','24hr'
df = r.get_station_data(stations.index[0])

... or by multiple stations:

df = r.get_stations_data(*stations.index, param = 'PM2.5')

Getting data directly from devices

Using this API you get raw data directly from measuring devices. This API is rather slow dealing with big datasets, so be prepeared :)

The main steps are the same as with stations API:

devices = r.get_devices()

afterward get data from single or multiple sources:

df = r.get_device_data(device_serial_number)
df = r.get_devices_data(*devices, param='PM2.5')
You can’t perform that action at this time.