Skip to main content

Simple wrappers to load and convert common data file types

Project description

https://img.shields.io/pypi/v/pandect.svg https://img.shields.io/travis/datagazing/pandect.svg Documentation Status

Simple wrappers to load and convert common data file types

Features

  • Uses file extension as heuristic to determine input format

  • Provides metadata using pyreadstat objects when appropriate

  • Supports: csv, tsv, xlsx, sav, dta (unreliable), sqlite3

  • Loads data into pandas.DataFrame

  • Provides command line utilities: sav2dta, pandect

Examples

Load a data file into a pandas.DataFrame object:

>>> import pandect
>>> data, meta = pandect.load(input_file_name)

Save a pandas.DataFrame object as a data file:

>>> import pandas
>>> import pandect
>>> data = pandas.DataFrame([{'a': 1, 'b': 2}, {'a': 3, 'b': 4}])
>>> pandect.save(data=data, output='out.sav')
>>>

Save a pandas.DataFrame object as a data file with metadata:

>>> import pandas
>>> import pandect
>>> import pyreadstat
>>> data = pandas.DataFrame([{'a': 1, 'b': 2}, {'a': 3, 'b': 4}])
>>> meta = pyreadstat.metadata_container()
>>> meta.column_names_to_labels = {'a': 'A Label', 'b': 'B Label'}
>>> pandect.save(data=data, output='out.sav', meta=meta)
>>>

Convert a data file at the command line:

$ pandect input.csv output.dta

Convert sav data file to dta data file:

$ sav2dta some_file.sav
  • Derives output file name from input file name (here: some_file.dta)

  • This is a convenience utility for a common task

  • It is basically a special case of the pandect utility

Limitations

  • Loading dta files is unreliable (bug in pyreadstat, might segfault)

License

  • Free software: MIT license

Documentation

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

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

pandect-0.4.0.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

pandect-0.4.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file pandect-0.4.0.tar.gz.

File metadata

  • Download URL: pandect-0.4.0.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for pandect-0.4.0.tar.gz
Algorithm Hash digest
SHA256 ac2a315d196edff03b174da4550b1a6ee68a820a681cb9e175704af451858561
MD5 dfcb3c3adf92f8aecdc4e425c8960511
BLAKE2b-256 bf86b546b933e182fdfc01ee326fb955e4c2ce7af09736fcd803510f3a47dd04

See more details on using hashes here.

File details

Details for the file pandect-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pandect-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for pandect-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3f03e577543b22123bf4b31794ddc54d5e7074adb0ef1f5d5fd965962f3736a4
MD5 6c5b2906cda29c6bf09284a033fd16ac
BLAKE2b-256 dd7aefd8bf662a6f8b81a14c29d97f0d41249db586bd9543553d81645eb8ff34

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