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-2.0.1.tar.gz (57.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-2.0.1-py3-none-any.whl (43.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: macroecon_tools-2.0.1.tar.gz
  • Upload date:
  • Size: 57.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for macroecon_tools-2.0.1.tar.gz
Algorithm Hash digest
SHA256 87533fb3591b8427bc365e9daa706bb01f4fc8015cdcebe9df91a528865691f3
MD5 0677f278f0ce90e2a8d0e11260429ea4
BLAKE2b-256 9ad5e0fecef5f9848452d0ed214c9afc50d952f7ed8845e3a233ddb45a197663

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for macroecon_tools-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7d334f679508b9dfee77514f8f67b7d1bb5abfb2ced86ab3a63bd6e58a17d51e
MD5 7dc0d1b1beb9a1313da1e91f1c4eae56
BLAKE2b-256 c5fdb3bd9f5b2d2674d4cd0935577e8cd2a4572ab9d001bcc22342db0848d1ef

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