Overview of pyreadstat capabilities
masterpyreadstat is a Python wrapper around the Readstat C library. It allows you to read and write various statistical data files into pandas or polars dataframes.
Supported Formats:
- SAS:
sas7bdat,sas7bcat,xport - SPSS:
sav,zsav,por - STATA:
dta
Key Advantages over pandas.read_sas:
- Performance: Significantly faster for large files (e.g., reading a 190MB SAS file in 7s vs 42s with pandas).
- Value Labels: Can extract value labels from SPSS, STATA, and SAS catalog files.
- Date/Datetime Accuracy: Correctly distinguishes between
dateanddatetimetypes instead of converting all todatetime. - Encoding: Automatically handles character encodings and translates them to UTF-8, returning Python
strinstead ofbytes.