Skip to main content

Process INE's ECH surveys in Python.

Project description

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")

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.grouping and by (both are optional). Cases are weighted by the column defined in ECH.load.

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

pyech-0.0.16.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyech-0.0.16-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file pyech-0.0.16.tar.gz.

File metadata

  • Download URL: pyech-0.0.16.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pyech-0.0.16.tar.gz
Algorithm Hash digest
SHA256 2fc332a083234478b02c8719339a9e9f46620c70d80a9bce5efc5e4289ae4f85
MD5 f8477535230eaf2df15accd1b16e99df
BLAKE2b-256 3403ea9bd6d0888cac1c2f73cc2d83ed7cb8b9b6e72cf3389bcbd0ab4bf16556

See more details on using hashes here.

File details

Details for the file pyech-0.0.16-py3-none-any.whl.

File metadata

  • Download URL: pyech-0.0.16-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pyech-0.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 1a1829e227088bcdfdaf2e41c4d5b88aa994afbd969be5c28339756a7b6e631a
MD5 9f186b94dc2d9d11c5d75a4d7b6f910b
BLAKE2b-256 99f4bac360d641bbdca30197543f9e7b2d9ac16ebde2e0311ddf274c95628fae

See more details on using hashes here.

Supported by

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