Referencia API
Para los detalles de cualquier metodo de bcrpy, se puede hacer una busqueda rapida de algun metodo con Ctrl+F y escribiendo el nombre del metodo
(ejemplo: Ctrl+F “plot”).
Metodos globales
- class bcrpy.save_dataframe(df, filename)
Guarda la informacion de datos almacenados y procesados por Python en un archivo
Parametros
- filename: str
Nombre del archivo para guardar. Si el nombre termina con el sufijo “.csv”, se guarda como archivo CSV, si termina con “.md”, se guarda como archivo Markdown. En otro caso, el archivo se guarda en formato de Python [‘pickle’]
Metodos locales a la clase bcrpy.Marco
- class bcrpy.Marco
- __init__()
Main framework for storing variables and executing methods to extract, search, and handle data.
Attributes
- metadatapd.DataFrame
DataFrame to store metadata of statistical series from BCRPData.
- datapd.DataFrame
DataFrame to store extracted data from BCRPData.
- codeslist of str
List of series codes of interest.
- startstr
Start date for the selected series in year-month format (default: ‘2010-1’).
- endstr
End date for the selected series in year-month format (default: ‘2016-9’).
- formatstr
Format for extracting/processing data (default: ‘json’).
- langstr
Selected language (default: ‘ing’ for English). Other option is ‘esp’ for Spanish.
- parameters()
Declare the current state of all constructor variables of the Marco class.
- query(codigo='PD39793AM')
Query series code, printed in JSON format.
- query_dict(codigo='PD39793AM')
- wordsearch(keyword='economia', cutoff=0.65, columnas='all')
Perform a fuzzy search for keywords in the BCRPData metadata.
Parameters
- keywordstr
Keyword to search for in the metadata.
- cutofffloat
Similarity cutoff for the fuzzy matching (default is 0.65).
- columnasstr or list of int
Columns to search in. If ‘all’, search in all columns (default is ‘all’).
- order_columns(hacer=True)
Sub-method to reorder columns according to how they were defined in objeto.codes.