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:
saveandload: 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:
saveandload: Methods to save and load the time series data into a pkl file.to_latexandto_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.
Metadata
Release files for macroecon-tools 2.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| macroecon_tools-2.0.2.tar.gz | 57.1 kB | Without provenance | Details for macroecon_tools-2.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| macroecon_tools-2.0.2-py3-none-any.whl | Python 3 | none | any | Details for macroecon_tools-2.0.2-py3-none-any.whl |
Total release size: 100.3 kB
Release files / macroecon_tools-2.0.2.tar.gz
| Download URL | macroecon_tools-2.0.2.tar.gz |
|---|---|
| Size | 57.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c3bb33d5f878a3397c370c3547fdd1fbc37045970d348cc8e67113e2e8c8ff9
|
|
BLAKE2b-256 checksum How to use checksums |
8af7fc0f3dd84177bd6b0081db145278e762c03912c28b0edfa763c66e54adaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / macroecon_tools-2.0.2-py3-none-any.whl
| Download URL | macroecon_tools-2.0.2-py3-none-any.whl |
|---|---|
| Size | 43.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3865ffbc63fb16c7ace9dce320ae791064ef039d8a24296de5dd66c934515471
|
|
BLAKE2b-256 checksum How to use checksums |
873ea039925344072d3b3f00035043792e29a68eefa564f63c1e0e0961ce3efb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Security for macroecon-tools 2.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.