无法在Python中打开.sav文件(spss)(我去年打开了)



我正在尝试访问去年打开的.sav (spss)文件(我不记得如何打开(,但我不能。 可能出了什么问题?

这是我的尝试:

data = pd.read_spss('eleghos_symperiforas.sav')
---------------------------------------------------------------------------
ReadstatError                             Traceback (most recent call last)
<ipython-input-46-a3e3803835b2> in <module>
----> 1 data = pd.read_spss('eleghos_symperiforas.sav')
~Anaconda3envstf2libsite-packagespandasiospss.py in read_spss(path, usecols, convert_categoricals)
41 
42     df, _ = pyreadstat.read_sav(
---> 43         path, usecols=usecols, apply_value_formats=convert_categoricals
44     )
45     return df
pyreadstatpyreadstat.pyx in pyreadstat.pyreadstat.read_sav()
pyreadstat_readstat_parser.pyx in pyreadstat._readstat_parser.run_conversion()
pyreadstat_readstat_parser.pyx in pyreadstat._readstat_parser.run_readstat_parser()
pyreadstat_readstat_parser.pyx in pyreadstat._readstat_parser.check_exit_status()
ReadstatError: Invalid file, or file has unsupported features

你有什么建议? 该文件没有损坏,因为我从第三个来源再次获得它。

我遇到了同样的问题。我看到他们在 1.0 年 2020 月发布了 pyreadstat 版本(这是熊猫用来打开 SPSS 的库(。我恢复到0.3.4版,它再次工作。

所以:

pip uninstall pyreadstat
pip install pyreadstat==0.3.4

最新更新