Skip to main content

Module for py4macro.github.io

Project description

PyPI version fury.io

はじめに

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

以下が含まれている。

  • Hodrick-Prescottフィルターを使い時系列データのトレンドを返す関数
  • DataFrameを全て表示するshow関数
  • 3つのデータ・セット
    • Penn World Tables 10.0
    • IMF World Economic Outlook 2021
    • Maddison Project Database 2020
    • Japan's quarterly data

使い方

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'])

DataFrameの行・列を全て表示する

py4macro.show(df)

引数

  • dfDataFrame

返り値

DataFrameの表示のみ

3つのデータ・セット

py4macro.data(dataset=None, description=0)

引数

  • 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
    • 'jpn-q': Japan's quarterly data
  • description (デフォルト:0, 整数型):

    • 0: データのDataFrameを返す
      • 全てのデータセット
    • 1: 変数の定義を全て表示する
      • 全てのデータセット
    • 2: 変数の定義のDataFrameを返す
      • 'pwt''weo'``'mad'のみ
    • -1: 何年以降から予測値なのかを全て示す
      • 'weo'のみ
    • -2: 何年以降から予測値なのかを示すDataFrameを返す
      • 'weo'のみ

返り値DataFrameもしくはDataFrameの表示

例1:IMF World Economic OutlookのDataFrameを返す

py4macro.data('weo')

例2:IMF World Economic Outlookの変数定義の全てを表示する

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

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

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

例4:IMF World Economic Outlookの変数の推定値の開始年を全て表示する

py4macro.data('weo',description=-1)

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

py4macro.data('weo',description=-2)

インストール方法

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.3.1.tar.gz (7.1 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.3.1-py2.py3-none-any.whl (4.0 MB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: py4macro-0.3.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for py4macro-0.3.1.tar.gz
Algorithm Hash digest
SHA256 5e6f00782ac498ba2d5b8db2106ce3f1961d4fd40d850b79f49d3f5fe9b95dd1
MD5 5f366ae57af54428e362911fe76d0453
BLAKE2b-256 6dd31621f4c24cd54fac05de9a6cf07e3af6b59d5c9e265f65f596834dc47c10

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for py4macro-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0f8a73068b46c61e4ba05db7cadda4b0feb4f00fae01264a2ca268235b3dc511
MD5 bf4559152bbc327565858576e98f4a5c
BLAKE2b-256 9981cccace13d21f1f6275abb223c5a43b19d417832793295897c43fd4edd58b

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