poptartpudding
poptartpudding

Reputation: 25

How to open .sav file on Jupyter Notebook?

I am trying to open my .sav file on JUpyter notebook and have tried the following (using pyreadstat) :

import pandas as pd
import pyreadstat

df, meta = pyreadstat.read_sav('filename.sav')

However, the error kept appearing

Invalid file, or file has unsupported features

I have also tried using pandas instead

df = pd.read_spss('filename.sav')

and have received the same error.

My pyreadstat version is 0.3.4 (initially 1.1.0 but failed as well).

Upvotes: 1

Views: 3405

Answers (1)

Pablo Pino
Pablo Pino

Reputation: 26

Try using this code:

import pickle
import pandas

file = open('filename.sav')
df, meta = pickle.load(file)

hope it works.

Upvotes: 1

Related Questions