Skip to main content

Build status Documentation Status PyPI version Python 3.7

Overview

A simple package that streamlines the download-read-wrangling process needed to analyze the Encuesta Continua de Hogares survey carried out by the Instituto Nacional de Estadística (Uruguay).

Here's what PyECH can do:

  • Download survey compressed files.
  • Unrar, rename and move the SAV (SPSS) file to a specified path.
  • Read surveys from SAV files, keeping variable and value labels.
  • Download and process variable dictionaries.
  • Search through variable dictionaries.
  • Summarize variables.
  • Calculate variable n-tiles.
  • Convert variables to real terms or USD.

PyECH does not attempt to estimate any indicators in particular, or facilitate any kind of modelling, or concatenate surveys from multiple years. Instead, it aims at providing a hassle-free experience with as simple a syntax as possible.

Surprisingly, PyECH covers a lot of what people tend to do with the ECH survey without having to deal with software licensing.

For R users, check out ech.

Installation

pip install pyech

Dependencies

In order to unpack downloaded survey files you will need to have unrar in your system. This should be covered if you have WinRAR or 7zip installed. Otherwise sudo apt-get install unrar or what's appropiate for your system.

Usage

Loading a survey is as simple as using ECH.load, which will download it if it cannot be found at dirpath (by default the current working directory).

from pyech import ECH

survey = ECH()
survey.load(year=2019, weights="pesoano")

Optionally, load accepts from_repo=True, which downloads survey data from the PyECH Github repository (HDFS+JSON). Loading data this way is significantly faster.

ECH.load also downloads the corresponding variable dictionary, which can be easily searched.

survey.search_dictionary("ingreso", ignore_case=True, regex=True)

This will return a pandas DataFrame where every row matches the search term in any of its columns.

Calculating aggregations is as simple as using ECH.summarize.

survey.summarize("ht11", by="dpto", aggfunc="mean", household_level=True)

Which returns a pandas DataFrame with the mean of "ht11" grouped by ECH.splitter and by (both are optional). Cases are weighted by the column defined in ECH.load.

Metadata

Release files for pyech 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyech 0.1.0
File Size Uploaded Provenance Actions
pyech-0.1.0.tar.gz 13.5 kB Without provenance Details for pyech-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyech 0.1.0
File Interpreter ABI Platform Actions
pyech-0.1.0-py3-none-any.whl Python 3 none any Details for pyech-0.1.0-py3-none-any.whl

Total release size: 26.7 kB

Release files / pyech-0.1.0.tar.gz

Download URL pyech-0.1.0.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c58eaf72601751993692cb21ce697bd3ed75c753aa06ddaca58d613a1d2332be
BLAKE2b-256 checksum
How to use checksums
322524fc4e49f651d77afab7c560e3adca4ae9104f87cd8009ffb4b76aeeeaf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Release files / pyech-0.1.0-py3-none-any.whl

Download URL pyech-0.1.0-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
496355d39fd1fcc8963ec5613989ab12a33bf36bdef304a6460f04bab1e4660a
BLAKE2b-256 checksum
How to use checksums
81b9d098295ae168473bee8573cfcbaaf9d012b68bf0f38ebb5ac7f5275892dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

Security for pyech 0.1.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page