I tried using the read_SPSS
command, but it didn't work. The error seems to be telling me that I need pyreadstat
, but I'm unable to even install that. Why, though, would I need pyreadstat
? Isn't the ability to read .sav
just built into Pandas these days? I'm confused...
Here's the error text I get when I try using read_SPSS
:
ImportError Traceback (most recent call last)
<ipython-input-33-935d54be8b7a> in <module>
----> 1 twitter=pd.read_spss('twitter_study.sav')
/opt/anaconda3/lib/python3.8/site-packages/pandas/io/spss.py in read_spss(path, usecols, convert_categoricals)
34 DataFrame
35 """
---> 36 pyreadstat = import_optional_dependency("pyreadstat")
37
38 if usecols is not None:
/opt/anaconda3/lib/python3.8/site-packages/pandas/compat/_optional.py in import_optional_dependency(name, extra, raise_on_missing, on_version)
108 except ImportError:
109 if raise_on_missing:
--> 110 raise ImportError(msg) from None
111 else:
112 return None
ImportError: Missing optional dependency 'pyreadstat'. Use pip or conda to install pyreadstat.