'utf-8' codec can't decode byte 0xfe in position 341: invalid start byte
'utf-8' codec can't decode byte 0xfe in position 341: invalid start byte
when running
raw_data_np = np.genfromtxt("loan-data.csv", delimiter = ';', skip_header = 1, autostrip = True)
raw_data_np
any idea how to overcome this?
Thanks
Hi Ioannis,
thanks so much for reaching out! Could you specify which course and lecture this is in reference to? I'd like to download the dataset and check if I encounter the same error.
Best,
365 Eli
Hi Eli,
Thanks for replying. I encountered the error during the course "Intro to numpy". I do not remember the exact lecture but you can find the code in the notebook "A-Loan-Data-Example-with-NumPy-Complete.ipynb"
Hope that helps
Best,
Ioannis
Thanks Ioannis,
I didn't get the same error, when running the Notebook, but I've sent your question to Vik - the Author of the course. I'm sure he'll have some insight into the issue and will get back to you shortly. Let me know if there's anything else I can help with.
Best,
365 Eli
Thanks for the reply Eli, I will wait for Vik's response.
Best,
Ioannis
Hello Ioannis,
Sorry for the late reply! The issue here comes from the default value for the "decoder" parameter. This default value can vary by the geographical region set by your Operating System, but I won't get too much into it right now. To resolve this, you only need to provide the appropriate argument for the encoding parameter.
Let's try and set a value for the encoding
parameter, like cp855
.
raw_data_np = np.genfromtxt("loan-data.csv", delimiter = ';', skip_header = 1, autostrip = True, encoding = "cp855")
Alternatively, the file uses ANSI encoding, so you can try this instead.
raw_data_np = np.genfromtxt("loan-data.csv", delimiter = ';', skip_header = 1, autostrip = True, encoding = "ANSI")
If neither of those work, please check out this list of all the Standard Encodings in Python. To be honest, I believe either "cp855" or "ANSI" should work, but I wanted to give you the full list just in case.
Best,
365 Vik
Hi Vik,
Thank you very much. It worked using cp855.
Best,
Ioannis