Invalid index type

User 2448 | 2/4/2016, 4:05:46 PM

import graphlab as gl
sf = graphlab.SFrame({'a': [0, 1, 2]})

results in the following error:

TypeError: Invalid index type: must be SArray, list, int, or str

Unless I'm missing something, this seems to make SFrames unusable for me.


User 1174 | 2/4/2016, 8:18:43 PM


It seems like you are using unicode literals, and SFrame indexing does not support unicode literals.

You can to convert the unicode to python str before indexing to SFrame:


User 2448 | 2/9/2016, 6:48:31 PM

You're correct, I'm using unicode literals, as I usually do in Python 2 to keep Python 3 compatibility as much as possible.

Is this just something I'm going to have to live with? Naively from here it seems like something that should be implementable in Graphlab, to simply check the encoding first and change it if necessary.