Error creating dataset

I’m surely missing something here, but this produces an error:

h = ['machine', 'a1', 'a2']
l = [['NH TRACK', 0, 2.216666666666667], ['NH CR8.90 ', 4.675, 0], ['NH CR7.90', 2.6083333333333334, 0]]
d = system.dataset.toDataSet(h, l)

The error is:

jvm 1    | Caused by: org.python.core.PyException: Traceback (most recent call last):
jvm 1    |   File "<function:updateData>", line 7, in updateData
jvm 1    | TypeError: Unable to convert row 1, column 1 to type class java.lang.Integer

Isn’t it possible to have floating point values in a dataset?

Your first list:

['NH TRACK', 0, 2.216666666666667]

is defining the datatypes (string, int, float)

Then your second list uses different types:

['NH CR8.90 ', 4.675, 0]

(string, float, int)

Try using 0.0 instead of 0 and see if I’m totally wrong or not :slight_smile:

2 Likes

Ok, that was it indeed. Thanks!

A more verbose, but also more explicit option is to use the DatasetBuilder class; that way you can specify your datatypes manually.

2 Likes