Convert SFrame to TimeSeries error: "Index argument must be str type"

User 2247 | 9/25/2015, 6:41:54 AM

Hi,

I used the sample code from the site below and got error message of "Index argument must be str type". Any suggestion to fix it?

Thanks!

import graphlab as gl import datetime as dt d1 = dt.datetime(2013, 5, 7, 10, 4, 10) sf = gl.SFrame({'a':[1.1,2.1,3.1],'b':[d1,d1+dt.timedelta(5),d1+dt.timedelta(10)]}) ts = gl.TimeSeries(sf,index='b') print ts

Comments

User 91 | 9/25/2015, 7:42:09 AM

I am unable to reproduce this command. It works for me on GLC 1.6. Which version of this are you using?

` import graphlab as gl import datetime as dt d1 = dt.datetime(2013, 5, 7, 10, 4, 10) sf = gl.SFrame({'a':[1.1,2.1,3.1],'b':[d1,d1+dt.timedelta(5),d1+dt.timedelta(10)]}) ts = gl.TimeSeries(sf,index='b') print ts

-- End pasted text --

+---------------------+-----+ | b | a | +---------------------+-----+ | 2013-05-07 10:04:10 | 1.1 | | 2013-05-12 10:04:10 | 2.1 | | 2013-05-17 10:04:10 | 3.1 | +---------------------+-----+ [3 rows x 2 columns]

The index column of the TimeSeries is: b `


User 2247 | 9/25/2015, 6:28:39 PM

Thanks for your response! My version is GLC 1.6.1 which should be the latest version. And I used ipython notebook running the code above.

Thanks!


User 2247 | 9/25/2015, 7:19:50 PM

After I restarted the environment, it works perfect now. Thanks srikris!


User 2247 | 9/25/2015, 11:08:32 PM

The culprit is a line of code at the beginning "from future import unicode_literals" which conflicts with the code above. When I restarted the environment, I didn't execute this line and thus the code ran without error. Thanks!