Skip to main content

Utility for parsing Stata dictionary files for usage with Pandas.

Project description

statadict

pipeline Documentation Status

Small package that allows reading Stata dictionary files (usually .dct extension).

Extracted information can be used with Pandas when calling read_fwf() function.

Setup

To install package locally:

python3 -m pip install statadict --user

Or directly from repository:

make all
python3 -m pip install . --user 

Usage

Having Stata dictionary file and related fixed width field csv file without headers, you can now use Pandas to read data:

import pandas as pd
from statadict import parse_stata_dict

stata_dict = parse_stata_dict(file="dictionary-file.dct")
data = pd.read_fwf("related-fwf-file.dat", names=stata_dict.names, colspecs=stata_dict.colspecs)

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

statadict-1.1.0.tar.gz (11.5 kB view hashes)

Uploaded Source

Built Distribution

statadict-1.1.0-py3-none-any.whl (9.4 kB view hashes)

Uploaded Python 3

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