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)
引数:
s:Seriesもしくは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)
引数:
-
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
-
description(デフォルト:False):True: 変数の定義を表示する。
-
estimates(デフォルト:False):- (
dataset='weo'場合のみ有効になる) True:weoには変数の予測値が含まれるが,予測値の開始年を示す。
- (
返り値:
-
dataset='weo'以外の場合:description=Falseの場合はDataFramedescription=Trueの場合は変数の定義のDataFrame
-
dataset='weo'の場合:description=False,estimates=Falseの場合はDataFramedescription=True,estimates=Falseの場合は変数の定義のDataFramedescription=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
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
194e7713bf3bf68c65f2d08be8ce3e69d622d9c6a0ea1b4c53a34507ad12b22e
|
|
| MD5 |
9a4adcd0a742e77245052ee267b7c292
|
|
| BLAKE2b-256 |
eef90bc36109e3010f4f8e3bb68f5df0f135398588275281ba90d881ea1b7c5c
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
512f392ac04a82084c4c12d67c799c485f5a85724e56840b0c686063dfd89b85
|
|
| MD5 |
676403465e7dc5bfb7f17fb1a036de3b
|
|
| BLAKE2b-256 |
307e2fe29a85118423d2559efe54d2f506e155c16227fa47e892b8097e62bd5d
|