Skip to main content

economics

economics provides a toolkit with economical computations based on data from data.okfn.org.

Features

  • CPI

  • Inflation (based on CPI by default)

Requirements

CPI

>> from economics 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 economics 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

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

Metadata

Release files for economics 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for economics 0.1.2
File Size Uploaded Provenance Actions
economics-0.1.2.tar.gz 17.2 kB Without provenance Details for economics-0.1.2.tar.gz

Release files / economics-0.1.2.tar.gz

Download URL economics-0.1.2.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
61b9279e60bc99761c464263e43b118d4da54294c977e3005cdea98f82beccf8
BLAKE2b-256 checksum
How to use checksums
72b9a41114c3e19834700b1bcea6de4d11876c16e69951e71a89268dfa6612f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for economics 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page