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.
Release files for pandect 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pandect-0.4.0.tar.gz | 28.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pandect-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.8 kB
Release files / pandect-0.4.0.tar.gz
| Download URL | pandect-0.4.0.tar.gz |
|---|---|
| Size | 28.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac2a315d196edff03b174da4550b1a6ee68a820a681cb9e175704af451858561
|
|
BLAKE2b-256 checksum How to use checksums |
bf86b546b933e182fdfc01ee326fb955e4c2ce7af09736fcd803510f3a47dd04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|
Release files / pandect-0.4.0-py3-none-any.whl
| Download URL | pandect-0.4.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3f03e577543b22123bf4b31794ddc54d5e7074adb0ef1f5d5fd965962f3736a4
|
|
BLAKE2b-256 checksum How to use checksums |
dd7aefd8bf662a6f8b81a14c29d97f0d41249db586bd9543553d81645eb8ff34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|