0

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?

Amin Marshal
  • 183
  • 2
  • 10
  • Possible duplicate of [Unpickling a python 2 object with python 3](https://stackoverflow.com/questions/28218466/unpickling-a-python-2-object-with-python-3) – Lex Scarisbrick Aug 26 '17 at 13:54

1 Answers1

1

Try this:

import pickle    
with open('dataset/s01.dat', 'rb') as f:
    x = pickle.load(f, encoding='latin1')
Tonechas
  • 13,398
  • 16
  • 46
  • 80
matt
  • 26
  • 1