pythonpandasspss-files

How can i read in file formats as a different file format? e.g. - SAV as CSV


So at my work we have to work in .sav files (SPSS files). Reason being for standardized purposes. I'm curious if i can read SPSS/.sav files into pandas as a csv and essentially bypass reading it in as an sav?

So for example, when i read in files in then convert to a csv i typically do this:

df = pd.read_spss('filepath.sav')
df.to_csv('filepath.csv')
df = pd.read_csv('filepath.csv')

this is extremely inefficent and SLOW, because reading in .sav files is a slow/time consuming process.

so what i'm wondering, is can i read .sav files as .csv files without needing to first read it in as a .sav?


Solution

  • Doesn't pd.read_spss return a DataFrame just like pd.read_csv ?