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.2.tar.gz (57.1 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.2-py3-none-any.whl (43.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: macroecon_tools-2.0.2.tar.gz
  • Upload date:
  • Size: 57.1 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.2.tar.gz
Algorithm Hash digest
SHA256 3c3bb33d5f878a3397c370c3547fdd1fbc37045970d348cc8e67113e2e8c8ff9
MD5 c2da0ef11075df45c5fe29aad3839347
BLAKE2b-256 8af7fc0f3dd84177bd6b0081db145278e762c03912c28b0edfa763c66e54adaf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for macroecon_tools-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3865ffbc63fb16c7ace9dce320ae791064ef039d8a24296de5dd66c934515471
MD5 92f34d6aba80d6fcc6ac2b8b6d0b5b8e
BLAKE2b-256 873ea039925344072d3b3f00035043792e29a68eefa564f63c1e0e0961ce3efb

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