pandas.read_spss — pandas 3.0.0.dev0+2099.g3832e85779 documentation (original) (raw)

pandas.read_spss(path, usecols=None, convert_categoricals=True, dtype_backend=<no_default>, **kwargs)[source]#

Load an SPSS file from the file path, returning a DataFrame.

Parameters:

pathstr or Path

File path.

usecolslist-like, optional

Return a subset of the columns. If None, return all columns.

convert_categoricalsbool, default is True

Convert categorical columns into pd.Categorical.

dtype_backend{‘numpy_nullable’, ‘pyarrow’}

Back-end data type applied to the resultant DataFrame(still experimental). If not specified, the default behavior is to not use nullable data types. If specified, the behavior is as follows:

Added in version 2.0.

**kwargs

Additional keyword arguments that can be passed to pyreadstat.read_sav().

Added in version 3.0.

Returns:

DataFrame

DataFrame based on the SPSS file.

See also

read_csv

Read a comma-separated values (csv) file into a pandas DataFrame.

read_excel

Read an Excel file into a pandas DataFrame.

read_sas

Read an SAS file into a pandas DataFrame.

read_orc

Load an ORC object into a pandas DataFrame.

read_feather

Load a feather-format object into a pandas DataFrame.

Examples

df = pd.read_spss("spss_data.sav")