Coder Social home page Coder Social logo

inflation_calc's Introduction

inflation_calc

inflation_calc provides a toolkit with economical computations based on data from data.okfn.org. This project builds heavily on the work of economics <https://pypi.python.org/pypi/economics>

Features

  • CPI
  • Inflation (based on CPI by default)
  • predict (predicts future cpi's based on current cpi's using ARIMA)

Requirements

CPI

>> from inflation_calc.cpi import CPI
>> import datetime
>>
>> # Create a new CPI instance
>> cpi = CPI()
>>
>> # Get CPI for Iceland in 2007
>> cpi.get(datetime.date(2007,1,1), 'Iceland')
CPI(date=datetime.date(2007, 1, 1), value=112.07753358)
>>
>> # We're going to work with Iceland so set default country
>> # (we're creating a new instance but the country variable can be set)
>> iceland = CPI(country='Iceland')
>>
>> # Get CPI in 2012 (not in the data)
>> iceland.get(datetime.date(2012,1,1))
...
KeyError: 'Date 2012-01-01 not found in data'
>>
>> # Get the closest CPI value sintead
>> iceland.closest(datetime.date(2012,1,1))
CPI(date=datetime.date(2011, 1, 1), value=155.03663004)

Inflation

>> from inflation_calc.inflation import Inflation
>> import datetime
>>
>> # Create a new Inflation instance
>> inflation = Inflation()
>>
>> # How many US $ would I need in 2011 to pay for what cost $5 in 2007
>> inflation.inflate(5, datetime.date(2011,1,1), datetime.date(2007,1,1), 'United States')
5.424340332378624
>>
>> # We can also set the reference year and the country
>> usa_2007 = Inflation(reference=datetime.date(2007,1,1), country='United States')
>>
>> # Get the inflation for 2007 in the United States
>> usa_2007.get(datetime.date(2011,1,1))
Inflation(factor=1.0848680664757249, value=0.08486806647572484)

License

inflation_calc is available under the GNU General Public License, version 3. See LICENCE for more details.

inflation_calc's People

Contributors

ericschles avatar roll avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.