Skip to content
Advertisement

Python loadarff fails for string attributes

I am trying to load an arff file using Python’s ‘loadarff’ function from scipy.io.arff. The file has string attributes and it is giving the following error.

JavaScript

How to read the arff successfully?

Advertisement

Answer

Since SciPy’s loadarff converts containings of arff file into NumPy array, it does not support strings as attributes. In 2020, you can use liac-arff package.

JavaScript

However, make sure your arff document does not contain inline comments after a meaningful text. So there won’t be such inputs:

JavaScript

Delete or move comment to the next line.

I’d got such mistake in one document and it took some time to figure out what’s wrong.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement