bcrp-webscrapper
This repository has a module that allows the scrapping of the Peruvian Central of Reserve (BCRP) Statistics Database.
Structure
The repository contains the following folders:
src: Contains the.pyfiles where the functions are defined, specifically under thebcrp_webscrappersubdirectory.test: Includes example usage and tests for the functions, such as the Jupyter Notebookbcrp_webscrapping_test.ipynb.dist: Contains the distribution packages, such as.tar.gzand.whlfiles, for different versions of the project.build: Holds build-related files, including intermediate files and directories used during the packaging process.
Getting Started
Prerequisites
You need to make sure you have installed the following modules.
- Requests
- Unidecode
- Selenium
- Webdriver_manager
- openpyxl
pip install requests
pip install unidecode
pip install selenium
pip install webdriver_manager
pip install openpyxl
pip install more-itertools
Installation
pip install bcrp-webscrapper
Functions
The module defines the following main functions:
bcrp_search()
This function provides a basic searcher for the BCRP Database website. We provide the name of the series and the frequency we want and search for the data available. It returns a dataframe with all series that match our input.
bcrp_dataframe()
This function scraps series from the BCRP Database and gives us a dataframe with the series.
bcrp_graph()
This function graphs series from the BCRP Database.
download_graph()
This function scraps series from the BCRP Database and downloads the image in the given format (png, jpg, pdf).
Usage
- Example 1
from bcrp_webscrapper import *
var = "Expectativas"
freq = "Mensual"
print(bcrp.bcrp_search( var , freq))
var2 = "PBI"
print(bcrp.bcrp_search( var2 ))
- Example 2
from bcrp_webscrapper import *
codes = ['PD04637PD', 'PD04638PD']
start_date = '2012-03-12'
end_date = '2022-05-30'
freq = 'Diario'
bcrp.bcrp_dataframe( codes , start_date , end_date , freq)
- Example 3
from bcrp_webscrapper import *
codes = ['PD09919MA', 'PD09920MA']
start_date = '2015'
end_date = '2022'
bcrp.bcrp_graph( codes , start_date , end_date )
For more examples, please refer to the the test folder.
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE for more information.
Contact
- Email: estcab00@gmail.com
Metadata
Release files for bcrp-webscrapper 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bcrp_webscrapper-1.0.6.tar.gz | 8.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bcrp_webscrapper-1.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.9 kB
Release files / bcrp_webscrapper-1.0.6.tar.gz
| Download URL | bcrp_webscrapper-1.0.6.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
949f04b97363d42810907272129432b1a0bfdf2bf9dd71208473cc6719db5318
|
|
BLAKE2b-256 checksum How to use checksums |
c335170e64f2d3d6179c0775c2b90cb9e1a069755287c02bcd23f4ac9c795680
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / bcrp_webscrapper-1.0.6-py3-none-any.whl
| Download URL | bcrp_webscrapper-1.0.6-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60a9b6199fdb8abb6425b41e404a5f3a364ab281ba8e4fd16213addbd5edf1d6
|
|
BLAKE2b-256 checksum How to use checksums |
f08953a936fdc87dc8afc907ae3d16e9a5a6eab5bab7d880e7849a7868d94867
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|