An interface for several Australian socio-economic indices.
Project description
ausdex
An interface for several Australian socio-economic indices.
The Australian Bureau of Statistics (ABS) publishes a variety of indexes for the Australian
economic environment. These include the Consumer Price Index (CPI) used for calculating inflation
and a variety of indexes designed to measure socio-economic advantage. ausdex
makes these data
available in a convenient Python package with a simple programatic and command line interfaces.
Installation
You can install ausdex
from the Python Package Index (PyPI):
pip install ausdex
Command Line Usage
Adjust single values using the command line interface:
ausdex inflation VALUE ORIGINAL_DATE
This adjust the value from the original date to the equivalent in today's dollars.
For example, to adjust $26 from July 21, 1991 to today run:
$ ausdex inflation 26 "July 21 1991"
$ 52.35
To choose a different date for evaluation use the --evaluation-date
option. e.g.
$ ausdex inflation 26 "July 21 1991" --evaluation-date "Sep 1999"
$ 30.27
seifa_vic command line usage
youc an use the seifa-vic command to interpolate an ABS census derived Socio economic score for a given year, suburb, and SEIFA metric
$ ausdex seifa-vic 2020 footscray ier_score
$ 861.68
Module Usage
>>> import ausdex
>>> ausdex.calc_inflation(26, "July 21 1991")
52.35254237288135
>>> ausdex.calc_inflation(26, "July 21 1991",evaluation_date="Sep 1999")
30.27457627118644
The dates can be as strings or Python datetime objects.
The values, the dates and the evaluation dates can be vectors by using NumPy arrays or Pandas Series. e.g.
>>> df = pd.DataFrame(data=[ [26, "July 21 1991"],[25,"Oct 1989"]], columns=["value","date"] )
>>> df['adjusted'] = ausdex.calc_inflation(df.value, df.date)
>>> df
value date adjusted
0 26 July 21 1991 52.352542
1 25 Oct 1989 54.797048
seifa_vic submodule
>>> from ausdex.seifa_vic import interpolate_vic_suburb_seifa
>>> interpolate_vic_suburb_seifa(2007, 'FOOTSCRAY', 'ier_score')
874.1489807920245
>>> interpolate_vic_suburb_seifa([2007, 2020], 'FOOTSCRAY', 'ier_score', fill_value='extrapolate')
array([874.14898079, 861.68112674])
Dataset and Validation
Inflation datasets
The Consumer Price Index dataset is taken from the Australian Bureau of Statistics. It uses the nation-wide CPI value. The validation examples in the tests are taken from the Australian Reserve Bank's inflation calculator. This will automatically update each quarter as the new datasets are released.
The CPI data goes back to 1948. Using dates before this will result in a NaN.
seifa_vic datasets
Data for the socio economic scores by suburbs comes from a variety of sources, and goes between 1986 to 2016 for the index of economic resources, and the index of education and opportunity, other indices are only available for a subset of census years
When this module is first used, data will be downloaded and preprocessed from several locations. Access to the aurin API is necessary via this form. You will be prompted to enter the username and password when you first run the submodule. This will be saved in the app user directory for future use. You can also create a config.ini file in the repository folder with the following:
[aurin]
username = {aurin_api_username}
password = {aurin_api_password}
Development
To devlop ausdex, clone the repo and install the dependencies using poetry:
git clone https://github.com/rbturnbull/ausdex.git
cd ausdex
poetry install
You can enter the environment by running:
poetry shell
The tests can be run using pytest
.
Credits
ausdex was written by Dr Robert Turnbull and Dr Jonathan Garber from the Melbourne Data Analytics Platform.
Please cite from the article when it is released. Details to come soon.
Acknowledgements
This project came about through a research collaboration with Dr Vidal Paton-Cole and A/Prof Robert Crawford. We acknowledge the support of our colleagues at the Melbourne Data Analytics Platform: Dr Aleksandra Michalewicz and Dr Emily Fitzgerald.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ausdex-0.2.0.tar.gz
.
File metadata
- Download URL: ausdex-0.2.0.tar.gz
- Upload date:
- Size: 65.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/21.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 635215771a923435eee234e52ab96ebd8e7d7a40160c4286f0d07128abeef750 |
|
MD5 | 57ec9bb1aee7407f06f95b5b7bbe9327 |
|
BLAKE2b-256 | 5f72c3b3be5105a74ea671c29d05d122dc7ab19222fce11157bb62fc31c59afe |
File details
Details for the file ausdex-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: ausdex-0.2.0-py3-none-any.whl
- Upload date:
- Size: 64.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/21.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d2f50f1523eff36dbb204a4aa7ac6fcedf60559a08ce23e0c8433ef2f743c11 |
|
MD5 | 09de02d44639accc2b013727fe1b924e |
|
BLAKE2b-256 | 03283f69382568dec1bcff41ea3972139e3484bf69f330d592619a528e487166 |