Closed
Description
Feature Type
-
Adding new functionality to pandas
-
Changing existing functionality in pandas
-
Removing existing functionality in pandas
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