Last answered:

27 May 2021

Posted on:

25 Apr 2021

1

Numpy - Unable to load data

I try to load data, but I get this error message: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfe in position 341: invalid start byte
Does anyone know what I can do. numpy version: '1.19.2' Code: raw_data_np = np.genfromtxt("loan-data.csv", delimiter = ';', skip_header = 1, autostrip = True)
raw_data_np

3 answers ( 0 marked as helpful)
Posted on:

09 May 2021

1

I am facing the same issue. Kindly share if someone has been able to resolve this.

Posted on:

27 May 2021

0

I missed your question and just posted this very question. Hope we can get a resolution. Annoying the data set won't load.

Posted on:

27 May 2021

0

If anyone is sitll looking and hasn't found the answer, I had to add this:

raw_data_np = np.genfromtxt('loan-data.csv', delimiter=';', encoding= 'unicode_escape')
raw_data_np

Also, this seems to work as well: "encoding='cp1252'"

Found the answers quite by accident here: https://www.codegrepper.com/code-examples/python/+genfromtxt+UnicodeDecodeError%3A+%27utf-8%27+codec+can%27t+decode+byte+0xfe+in+position+341%3A+invalid+start+byte

Submit an answer