I have the following dataframe
:
import pandas as pd
mc_all = pd.DataFrame({'col_1': [0,1,1,2],
'col_2' : ['france','france','uk','uk']})
I am trying this in order to save this dataframe
into a sav
file
args = ( list(mc_all.columns), dict(zip(list(mc_all.columns),[0]*len(list(mc_all.columns)))) )
with SavWriter('mc_all.sav',*args) as writer:
writer.writerows(mc_all)
according to this but it doesnt work. it throws an error:
error.SPSSIOError: Problem committing header [SPSS_INVALID_HANDLE]
Any ideas ?