Error returned up loading 'loan-data.csv'
I'm trying to get through the last section '9.1 Loan Data Example with Numpy'. Unfortunately, up trying to load the data set provided in the course materials, I get an error and can't load the data. I'm using the following, as suggested:
raw_data_np = np.genfromtxt("loan-data.csv", delimiter = ';',skip_header=1, autostrip = True)
And this is the error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfe in position 341: invalid start byte
I've tried a few SO posts but found nothing conclusive. This hasn't come up before - is there something wrong with this dataset? Why would the coding be off?
For anyone having the same problem, this is the solution that worked for me. Either:
raw_data_np = np.genfromtxt('loan-data.csv', delimiter=';', encoding='cp1252')
raw_data_np = np.genfromtxt('loan-data.csv', delimiter=';', encoding='unicode_escape')
I don't know enough about unicode to say what the problem was, or why the above worked (or which one is better than the other) but both of them seemed to return the correct data (ie the data as presented in the lesson).