Amin Marshal
Amin Marshal

Reputation: 183

Read a *.dat file in python from a dataset

I'm trying to read a .dat file from the DEAP dataset (http://www.eecs.qmul.ac.uk/mmv/datasets/deap/readme.html) however when using the pickle module, this error occures:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 0: ordinal not in range(128)

and this is the simple code: dataset = pc.load(open('dataset/s01.dat','rb'))

so my question is: 1. How can I read it? 2. which module should I use?

Upvotes: 0

Views: 1516

Answers (1)

matt
matt

Reputation: 26

Try this:

import pickle    
with open('dataset/s01.dat', 'rb') as f:
    x = pickle.load(f, encoding='latin1')

Upvotes: 1

Related Questions