Tag Archives: csv

java.lang.IllegalArgumentException: Index for header ‘XXX‘ is 1 but CSVRecord only has 1 value

Java, error in importing CSV file.

Error locating to the following code

This is a simple string array, value. Consider the reason for the error.

The data of CSV is as follows:

Xiao Ming, 1,2,3

Xiao Li, 3,4,5

If the separator of your CSV file is different from the one set by your program, this error is likely to occur.

solve:

Solve the ‘UTF-8’ codec can’t decode byte 0xe9 in position 3114: invalid continuation byte error

Today, when using Python to open a file, the following error was reported:

the code is as follows:

movies = pd.read_table('../../dataset/ml-1m/movies.dat', sep='::', header=None, engine='python', encoding='utf-8').to_numpy()

Solution:
change the code to: iso-8859-1 just

movies = pd.read_table('../../dataset/ml-1m/movies.dat', sep='::', header=None, engine='python', encoding='ISO-8859-1').to_numpy()