Skip to content

Slightly rephrase SPSS doc #27754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions doc/source/user_guide/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5491,30 +5491,29 @@ The top-level function :func:`read_spss` can read (but not write) SPSS
`sav` (.sav) and `zsav` (.zsav) format files.

SPSS files contain column names. By default the
whole file is read, categorical columns are converted into ``pd.Categorical``
whole file is read, categorical columns are converted into ``pd.Categorical``,
and a ``DataFrame`` with all columns is returned.

Specify a ``usecols`` to obtain a subset of columns. Specify ``convert_categoricals=False``
Specify the ``usecols`` parameter to obtain a subset of columns. Specify ``convert_categoricals=False``
to avoid converting categorical columns into ``pd.Categorical``.

Read a spss file:
Read an SPSS file:

.. code-block:: python

df = pd.read_spss('spss_data.zsav')
df = pd.read_spss('spss_data.sav')

Extract a subset of columns ``usecols`` from SPSS file and
Extract a subset of columns contained in ``usecols`` from an SPSS file and
avoid converting categorical columns into ``pd.Categorical``:

.. code-block:: python

df = pd.read_spss('spss_data.zsav', usecols=['foo', 'bar'],
df = pd.read_spss('spss_data.sav', usecols=['foo', 'bar'],
convert_categoricals=False)

More info_ about the sav and zsav file format is available from the IBM
web site.
More information about the `sav` and `zsav` file format is available here_.

.. _info: https://www.ibm.com/support/knowledgecenter/en/SSLVMB_22.0.0/com.ibm.spss.statistics.help/spss/base/savedatatypes.htm
.. _here: https://www.ibm.com/support/knowledgecenter/en/SSLVMB_22.0.0/com.ibm.spss.statistics.help/spss/base/savedatatypes.htm

.. _io.other:

Expand Down