Skip to main content

A Python client for interacting with IBGE API for aggregate data.

Project description

pySidraData

Python Version License Build Status Coverage Status

pySidraData is a Python client for interacting with the IBGE (Instituto Brasileiro de Geografia e Estatística) API for aggregate data. It provides an easy-to-use interface to fetch, manipulate, and analyze data from the IBGE database.

Features

  • Fetch and explore root data from the IBGE API.
  • Retrieve metadata for specific aggregate IDs.
  • Convert data to a Pandas DataFrame for analysis.
  • Easy-to-use and extendable structure.
  • Supports Python 3.6 and above.

Installation

You can install pySidraData using pip:

pip install pySidraData

Alternatively, you can install it from the source:

git clone https://github.com/nandevers/pySidraData.git
cd pySidraData
pip install .

Usage

Here's a quick example of how to use pySidraData:

from pySidraData import Client

# Initialize the client
client = Client()

# Get root data
root_data = client.get_root_data()
for research in root_data.research_list:
    print(f"Research ID: {research.id}, Name: {research.nome}")
    for aggregate in research.agregados:
        print(f"  Aggregate ID: {aggregate.id}, Name: {aggregate.nome}")

# Get metadata for a specific aggregate ID
metadata = client.get_metadata('8418')
print(metadata)

# Convert root data to a Pandas DataFrame
df = client.get_root_data_as_dataframe()
print(df.head())

Documentation

The full documentation for pySidraData can be found here.

Contributing

We welcome contributions to pySidraData! If you have an idea for a feature or have found a bug, please check our contributing guidelines before you start. Here are some ways you can contribute:

  • Reporting Bugs: Use the issue tracker to report any bugs you find.
  • Feature Requests: If you have an idea for a new feature, please submit it as an issue with the label enhancement.
  • Pull Requests: If you want to contribute code, fork the repository and create a pull request with your changes.
  • Documentation: Help improve our documentation or add new examples.

We use pre-commit hooks to ensure code quality. Please install the hooks before making commits:

pip install pre-commit
pre-commit install

Setting Up the Development Environment

To set up the development environment, follow these steps:

  1. Clone the repository:

    git clone https://github.com/nandevers/pySidraData.git
    cd pySidraData
    
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
    
  3. Install the package in editable mode with development dependencies:

    pip install -e .[dev]
    
  4. Run the tests to make sure everything is set up correctly:

    python -m unittest discover tests
    

Running Tests

We use unittest for testing. To run the tests, use the following command:

python -m unittest discover tests

Make sure all tests pass before submitting a pull request.

Code Style

We follow PEP 8 for code style. Please ensure your code is formatted correctly before submitting a pull request. You can use flake8 to check for any style issues:

flake8 pySidraData/

License

pySidraData is licensed under the MIT License. See the LICENSE file for more information.

Acknowledgements

This project was inspired by the need to easily interact with the IBGE API for data analysis and research purposes. Special thanks to the IBGE for providing an accessible API.

Contact

If you have any questions or suggestions, feel free to open an issue or reach out to the maintainer at fernando.liaison@gmail.com.

Happy coding! We hope pySidraData makes your data analysis work easier and more enjoyable.

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

pysidradata-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

pySidraData-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file pysidradata-0.1.0.tar.gz.

File metadata

  • Download URL: pysidradata-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for pysidradata-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6579ae37c3274f21fb6446fab6c6c656bd62f6d14407ead3cec103f7e4ea24a8
MD5 ce79abb0fb17fbc8283f8624bf35f2f5
BLAKE2b-256 3bdd67f6dcf27386b7025f279ec19ebe4a8065523fb251cbaf9cd2d81884c94e

See more details on using hashes here.

File details

Details for the file pySidraData-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pySidraData-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for pySidraData-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c146daa47f79def58dbf26c50ace98fa12be0c25de0e474be474c6936c5a4362
MD5 230fe8bd168611af63a5fdf6ab2dcd29
BLAKE2b-256 44a645cf157304406d2726f880e752e3a3df1240ee6551540928b003df322ad9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page