Skip to main content

Contains a function and datasets for py4macro.github.io

Project description

はじめに

「Pythonで学ぶ中級マクロ経済学」で使うモジュール。

以下が含まれている。

  • Hodrick-Prescottフィルターを使い時系列データのトレンドを返す関数
  • 3つのデータ・セット
    • Penn World Tables 10.0
    • IMF World Economic Outlook 2021
    • Maddison Project Database 2020

使い方

import py4macro

Hodrick-Prescottフィルターによるトレンド抽出

py4macro.trend(s,lamb=1600)

引数:

  • sSeriesもしくは1列のDataFrameとし,行のラベルはDatetimeIndexにすること。
  • lamb: HPフィルターのlambda(デフォルトは四半期用のデータでは通常の値である1600としている)

返り値:

Hodrick-Prescottフィルターで計算したtrend(トレンド)のSeries

:

py4macro.trend(df.loc[:,'gdp'])

3つのデータ・セット

py4macro.data(dataset=None, description=False, estimates=False)

引数

  1. dataset (文字列):

    • 'pwt': Penn World Table 10.0
    • 'weo': IMF World Economic Outlook 2021
    • 'mad': country data of Maddison Project Database 2020
    • 'mad-regions': regional data of Maddison Project Database 2020
  2. description (デフォルト:False):

    • True: 変数の定義を表示する。
  3. estimates (デフォルト:False):

    • (dataset='weo'場合のみ有効になる)
    • True: weoには変数の予測値が含まれるが,予測値の開始年を示す。

返り値

  • dataset='weo' 以外の場合:

    • description=False の場合は DataFrame
    • description=True の場合は変数の定義のDataFrame
  • dataset='weo' の場合:

    • description=False, estimates=False の場合は DataFrame
    • description=True, estimates=False の場合は変数の定義のDataFrame
    • description=False, estimates=True の場合は変数の推定値の開始年のDataFrame

例1:Penn World TableのDataFrameを返す。

py4macro.data('pwt')

例2:Penn World Tableの変数の定義のDataFrameを返す。

py4macro.data('pwt',description=True)

例3:IMF World Economic OutlookのDataFrameを返す。

py4macro.data('weo')

例4:IMF World Economic Outlookの変数の定義のDataFrameを返す。

py4macro.data('weo',description=True)

例5:IMF World Economic Outlookの変数の推定値の開始年のDataFrameを返す。

py4macro.data('weo',estimates=True)

インストール方法

pip install py4macro

or

pip install git+https://github.com/Py4Macro/py4macro.git

or

git clone https://github.com/Py4Macro/py4macro.git
cd py4macro
pip install .

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

py4macro-0.1.2.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py4macro-0.1.2-py2.py3-none-any.whl (3.8 MB view details)

Uploaded Python 2Python 3

File details

Details for the file py4macro-0.1.2.tar.gz.

File metadata

  • Download URL: py4macro-0.1.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for py4macro-0.1.2.tar.gz
Algorithm Hash digest
SHA256 194e7713bf3bf68c65f2d08be8ce3e69d622d9c6a0ea1b4c53a34507ad12b22e
MD5 9a4adcd0a742e77245052ee267b7c292
BLAKE2b-256 eef90bc36109e3010f4f8e3bb68f5df0f135398588275281ba90d881ea1b7c5c

See more details on using hashes here.

File details

Details for the file py4macro-0.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: py4macro-0.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.8 MB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for py4macro-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 512f392ac04a82084c4c12d67c799c485f5a85724e56840b0c686063dfd89b85
MD5 676403465e7dc5bfb7f17fb1a036de3b
BLAKE2b-256 307e2fe29a85118423d2559efe54d2f506e155c16227fa47e892b8097e62bd5d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page