Banxico-SIE
This packages enables downloading economic and financial time series hosted on Banco de Mexico's Sistema de Informacion Economica (SIE) directly as a time-indexed Pandas DataFrame. Time series metadata is available on English and Spanish.
Credentials are required by the website to download data. Visit Banxico's Sistema de Informacion Economica API website to request a token.
Disclaimer: This package is not institutionally endorsed by Banco de Mexico and does not constitute an official Python package to access Banco de Mexico's data. Banco de Mexico does not provide any support to this package and is not liable by its use.
Installation
Install Banxico-SIE with pip
pip install Banxico-SIE
Usage
## Firstly, obtain a token from Banxico's website:
# https://www.banxico.org.mx/SieAPIRest/service/v1/?locale=en
banxico_token = "..." # 64 characters long
from siebanxico import SIEBanxico
# Choose language of metadata by choosing locale="es" (Spanish) or locale="en" (English).
api_client = SIEBanxico(token=banxico_token, locale="es")
## Get a single time series:
# Visit Banxico's website to find the id of a certain time series. E.g., "SP1" is Monthly CPI.
# https://www.banxico.org.mx/SieInternet/defaultEnglish.do
df = api_client.getSeriesData("SP1") # Get whole CPI time series
df = api_client.getSeriesData("SP1", startDate="2020-01-01", endDate="2020-12-31") # Get time series for a date range
# Note: startDate and endDate must be in the format YYYY-MM-DD.
# df is a time-indexed Pandas DataFrame.
# Use Pandas functionalities to manipulate data and perform transformations.
# For example:
df.head()
df.diff()
df.pct_change(12)
## Get multiple time series:
# This list must contain the ids of the time series. Visit Banxico's website to find this.
# https://www.banxico.org.mx/SieInternet/defaultEnglish.do
list_series = ["SP1", "SF311408", "SF311418", "SF311433"] # CPI, M1, M2, M3 (all in monthly frequency)
# Note: Periodicity of the time series must be identical!
# This function requires a pandas.offsets object for the periodicity argument.
# For monthly data use: pandas.offsets.MonthBegin(1)
# This is important because the library uses this object to create the dataframe's time index.
import pandas as pd
df = api_client.getSeriesDataFrame(list_series, startDate="2000-01-01", endDate="2023-07-31",
periodicity=pd.offsets.MonthBegin(1))
# Note: startDate and endDate must be in the format YYYY-MM-DD.
# df is a time-indexed Pandas DataFrame.
# Use Pandas functionalities to manipulate data and perform transformations.
# For example:
df.head()
df.diff()
df.pct_change(12)
## Get series metadata:
metadata_df = api_client.getSeriesMetaData(list_series)
## Get last values for a list of series:
lastvalues_df = api_client.getSeriesCurrentValue(list_series)
Authors
License
Metadata
Release files for Banxico-SIE 1.0.0
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 | |
|---|---|---|---|---|
| Banxico-SIE-1.0.0.tar.gz | 5.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Banxico_SIE-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.8 kB
Release files / Banxico-SIE-1.0.0.tar.gz
| Download URL | Banxico-SIE-1.0.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6fbb0c6324f3c19db9046f0b5c6ec220f76e83a5e95bcca1ddc80887ce187c45
|
|
BLAKE2b-256 checksum How to use checksums |
67ae9675e525ef93b0c761333005621f8c53f1db23b5e8280bf9909e729e2775
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Release files / Banxico_SIE-1.0.0-py3-none-any.whl
| Download URL | Banxico_SIE-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c92e865edfda0567b1a1f83e45f42d4e720cc15e44935a4066f91f6cc28f7c9
|
|
BLAKE2b-256 checksum How to use checksums |
975d6cccf635f64184e891d426bfc5f39d81f5979466a11c54410bf87f0c3ecf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Security for Banxico-SIE 1.0.0
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.