ENH: Add kwargs to pandas.read_spss so that pyreadstat keyword args can be used (original) (raw)

Feature Type

Problem Description

I have recently used pandas to convert .sav files to csv using pandas.read_spss, this has typically worked without issue.
I now have a .sav file that has text which is causing a read error in pandas.
I have been able to resolve this outside of pandas with pyreadstat by using the encoding="latin1" keyword argument

Feature Description

Keyword arguments here in pyreadstat docs
Something like this allowing to pass pyreadstat arguments
May need to handle output_format="dict"

def read_spss( path: str | Path, usecols: Sequence[str] | None = None, convert_categoricals: bool = True, dtype_backend: DtypeBackend | lib.NoDefault = lib.no_default, **kwargs, ) -> DataFrame: ... df, metadata = pyreadstat.read_sav( stringify_path(path), usecols=usecols, apply_value_formats=convert_categoricals, **kwargs, ) ... return df

Alternative Solutions

No alternative

Additional Context

No response