Package: ausdex
ausdexA Python package for adjusting Australian dollars for inflation.The Australian Bureau of Statistics (ABS) publishes the Consumer Price Index (CPI)
for Australia and its capital cities which allows for adjustment of the value of Australian dollars for inflation.ausdexmakes these data available with an inflation calculator in a convenient Python package with simple programmatic and command-line interfaces.ABS datasets are generally housed in Microsoft Excel spreadsheets linked from the data catalogue. Working with these spreadsheets directly is cumbersome. Theausdexpackage provides an Application Programming Interface (API) for Australian CPI data that seemlessly interoperates withNumPyandpandas. It makes working with Australian dollars in Python convenient in a similar manner to thecpiPython package which adjusts US dollars for inflation.The package is documented here:https://rbturnbull.github.io/ausdexInstallationYou can installausdexfrom the Python Package Index (PyPI):pip install ausdexausdexrequires Python 3.8 or higher.To install ausdex for development, see the documentation forcontributing.Command Line UsageAdjust single values using the command line interface:ausdex inflation VALUE ORIGINAL_DATEThis adjust the value from the original date to the equivalent for the most recent quarter.For example, to adjust $26 from July 21, 1991 to the latest quarter run:$ ausdex inflation 26 "July 21 1991" 
$ 52.35To choose a different date for evaluation use the--evaluation-dateoption. This adjusts the value to dollars in the quarter corresponding to that date. For example, this command adjusts $26 from July 1991 to dollars in September 1999:$ ausdex inflation 26 "July 21 1991"  --evaluation-date "Sep 1999"
$ 30.27By default,ausdexuses the CPI for Australia in general but you can calculate the inflation for specific capital cities with the--locationargument:$ ausdex inflation 26 "July 21 1991"  --evaluation-date "Sep 1999" --location sydney
$ 30.59Location options are: 'Australia', 'Sydney', 'Melbourne', 'Brisbane', 'Adelaide', 'Perth', 'Hobart', 'Darwin', and 'Canberra'.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
>>> ausdex.calc_inflation(26, "July 21 1991", evaluation_date="Sep 1999", location="sydney")
30.59083191850594The 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.797048Dataset and ValidationThe Consumer Price Index dataset is taken from theAustralian Bureau of Statistics. It uses the nation-wide CPI value. The validation examples in the tests are taken from theAustralian 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.To access the raw CPI data as a pandas DataFrame, use this function:df = ausdex.latest_cpi_df()The Excel spreadsheet for this is stored in the user's cache directory.
If you wish to download this Excel file to a specific location, use this function:ausdex.files.cached_download_cpi(local_path="cpi-data.xlsx")For more infomation about the methods to download data from the ABS, see theAPI specification.ContributingSee the guidelines for contributing and our code of conduct in thedocumentation.License and Disclaimerausdexis released under the Apache 2.0 license.While every effort has been made by the authors of this package to ensure that the data and calculations used to produce the results are accurate, as is stated in the license, we accept no liability or responsibility for the accuracy or completeness of the calculations.
We recommend that users exercise their own care and judgment with respect to the use of this package.Creditsausdexwas written byDr Robert TurnbullandDr Jonathan Garberfrom theMelbourne Data Analytics Platform.Please cite from the article when it is released. Details to come soon.AcknowledgementsThis project came about through a research collaboration withDr Vidal Paton-ColeandProf Robert Crawford. We acknowledge the support of our colleagues at the Melbourne Data Analytics Platform:Dr Aleksandra MichalewiczandDr Emily Fitzgerald.