Skip to main content

Suite of tools for macroeconomics analysis

Project description

Macroecon-Tools

A open-source set of tools to assist with macroeconomic work. The package includes two classes, Timeseries and TimeseriesTable, for working with time series data and collections of time series. The package is built on pandas and numpy to offer additional metadata and advanced operations tailored for macroeconomic analysis of time series.


Modules

  • timeseries: Contains the datastructures extended from pd.Series and pd.DataFrame.
    • Timeseries: A class that extends pd.Series to include metadata and additional methods.
    • TimeseriesTable: A class that extends a dictionary and includes functionality from pd.DataFrame.
  • fetch_data: Contains functions to fetch data from the internet.
    • get_fred: Fetches data from the Federal Reserve Economic Data (FRED) API.
    • get_barnichon: Fetches and parses data from the Barnichon dataset.
    • get_ludvigson: Fetches and parses data from the Ludvigson dataset.
  • visualizer: Contains functions to visualize time series data.
    • vis_multi_subplots: Visualizes multiple time series on the same page using subplots.
    • vis_two_vars: Visualizes two variables as the x/y axes.
    • vis_multi_lines: Visualizes multiple lines on the same plot.

Installation

To install the package, run the following command in the terminal:

pip install macroecon-tools

Timeseries Module

Timeseries Class

The Timeseries class extends the pd.Series class to include metadata and additional methods. The class is initialized with a pd.Series object and additional metadata. The additional metadata includes the following:

  • source_freq: The frequency of the source data.
  • data_source: The source of the data.
  • transformations: A list of transformations applied to the data (automatically tracked).

The class also includes additional methods for working with time series data. Utility methods include:

  • save and load: Methods to save and load the time series data into a pkl file.

Transformations include:

  • logdiff: Computes the log difference of the time series.
  • diff: Computes the difference of the time series.
  • log: Computes the log of the time series.
  • log100: Computes the log time 100 of the time series.
  • agg: Aggregates the time series data by a specified frequency and method.
  • truncate: Truncates the time series data by a specified start and end date.
  • dropna: Drops missing values from the time series data.

Additional methods for filtering:

  • linear_filter: Applies a linear filter to the time series data.
  • hamilton_filter: Applies the Hamilton filter to the time series data.
  • hp_filter: Applies the Hodrick-Prescott filter to the time series data.

TimeseriesTable Class

The TimeseriesTable class extends a dictionary and includes functionality from pd.DataFrame. The class is initialized with a dictionary of Timeseries objects. The dataframe can be accessed with the .df property.

The class includes additional methods for working with collections of time series data. Utility methods include:

  • save and load: Methods to save and load the time series data into a pkl file.
  • to_latex and to_markdown: Methods to convert the time series data to a LaTeX table or Markdown table.
  • corr: Computes the correlation matrix of the time series data.
  • data_moments: Computes the data moments of the specified variables of the time series data.

Additional methods for transformations:

  • truncate: Truncates the time series data by a specified start and end date.
  • dropna: Drops missing values from the time series data.
  • aggregate: Aggregates the time series data by a specified frequency and method.

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

macroecon_tools-1.0.13.tar.gz (56.0 kB view details)

Uploaded Source

Built Distribution

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

macroecon_tools-1.0.13-py3-none-any.whl (41.9 kB view details)

Uploaded Python 3

File details

Details for the file macroecon_tools-1.0.13.tar.gz.

File metadata

  • Download URL: macroecon_tools-1.0.13.tar.gz
  • Upload date:
  • Size: 56.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/8.5.0 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.32.3 rfc3986/1.5.0 tqdm/4.67.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for macroecon_tools-1.0.13.tar.gz
Algorithm Hash digest
SHA256 2e088720710ff0be04916ca7c746b962000e7f56d3d7680c3f82a820a769fe5d
MD5 8ddb73b65a684483e20a862f5f064fe1
BLAKE2b-256 b6dbf652310bdaee5d21304f4ffab4d0f5201d90382ee0c002b7a27e78783e1f

See more details on using hashes here.

File details

Details for the file macroecon_tools-1.0.13-py3-none-any.whl.

File metadata

  • Download URL: macroecon_tools-1.0.13-py3-none-any.whl
  • Upload date:
  • Size: 41.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/8.5.0 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.32.3 rfc3986/1.5.0 tqdm/4.67.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for macroecon_tools-1.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 1d684560d517c5fc10ebe2bbc3c8b9a1b4e93c40a5c92ce4eb75ca99bcfd3516
MD5 dc2eb9fc597b483d60840e3827751be5
BLAKE2b-256 8bfe6bedaa30a3b61529e65fd5bbe0308f12df8fa594589b7ccec4c151f7aab3

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