Skip to content

A simple utility that converts SPSS data to / from Pandas DataFrames, CSV, Excel, JSON, YAML, and dict.

License

Notifications You must be signed in to change notification settings

insightindustry/spss-converter

Repository files navigation

SPSS Converter

Simple format converter utility for SPSS data files

Branch Unit Tests
latest Build Status (Travis CI) Code Coverage Status (Codecov) Documentation Status (ReadTheDocs)
v.0.2 Build Status (Travis CI) Code Coverage Status (Codecov) Documentation Status (ReadTheDocs)
v.0.1 Build Status (Travis CI) Code Coverage Status (Codecov) Documentation Status (ReadTheDocs)

The SPSS Converter is a simple utility that facilitates the easy conversion of SPSS data to / from a variety of formats, including:

  • CSV
  • JSON
  • YAML
  • Excel
  • Pandas DataFrame

COMPLETE DOCUMENTATION: http://spss-converter.readthedocs.org/en/latest/index.html


To install the SPSS Converter via Pip just execute:

$ pip install spss-converter
Python 3.x
* Pandas v0.24 or higher
* Pyreadstat v1.0 or higher
* OpenPyXL v.3.0.7 or higher
* PyYAML v3.10 or higher
* simplejson v3.0 or higher

If you work with SPSS data in the Python ecosystem, you probably use a combination of two or three key libraries: Pandas, Pyreadstat, and savReaderWriter. All three libraries are vital tools, incredibly well-constructed, designed, and managed. But over the years, I have found that converting from SPSS to other file formats using these libraries requires some fairly repetitive boilerplate code. So why not make it easier?

The SPSS Converter library is a simple wrapper around the Pyreadstat and Pandas libraries that provides a clean and simple API for reading data files in a variety of formats and converting them to a variety of formats. The semantics are super simple, and should be as simple as: spss_converter.to_csv('my-spss-file.sav') or spss_converter.from_json('my-json-file.json').

  • With one function call, convert an SPSS file into:
    • a Pandas DataFrame
    • CSV
    • JSON
    • YAML
    • Excel
    • a dict
  • With one function call, create an SPSS data file from data in:
    • a Pandas DataFrame
    • CSV
    • JSON
    • YAML
    • Excel
    • a dict
  • With one function call, generate a Pythonic data map or meta-data collection from your SPSS data file.
  • Decide which variables (columns) you want to include / exclude when doing your conversion.

For a comparison of the SPSS Converter to various alternative conversion approaches, please see full documentation: https://spss-converter.readthedocs.io/en/latest/index.html#spss-converter-vs-alternatives

The SPSS Converter is a simple library, but its functions are comprehensively documented at:

https://spss-converter.readthedocs.org/en/latest/index.html

You can ask questions and report issues on the project's Github Issues Page


We welcome contributions and pull requests! For more information, please see the Contributor Guide


We use TravisCI for our build automation, Codecov.io for our test coverage, and ReadTheDocs for our documentation.

Detailed information about our test suite and how to run tests locally can be found in our Testing Reference.


The SPSS Converter is made available under an MIT License.