Can't modify single elements in an SFrame

User 541 | 7/28/2014, 2:01:07 PM

I want to change the value of an SArray inside an SFrame, but it seems that this is not possible. example: <code> import graphlab as gl

Data from ('')

graph = gl.load_graph('web-Google.txt.gz', format='snap') print graph.edges['__src_id'] graph.edges['aux'] = graph.edges['__src_id'] graph.edges[0]['aux'] = 0 graph.edges['aux'] </code> <br> As you can notice the value in [0]['aux'] didnt change to 0. Can this function be added to graphlab? or is there any way to alter values without using lambda expressions?


User 542 | 7/28/2014, 8:31:56 PM

How would you construct such a lambda expression that modifies a single vertex?

graph.edges['aux'].apply(lambda x: 0) #this would apply to all of the edges.

graph.vertices.apply(lambda x: {x['__id'], 0} if x['__id']==5 ) #this throws a syntax error... but this is where I'm wanting to go.

User 15 | 7/28/2014, 11:25:11 PM

If you use an if statement within a lambda, you must provide an 'else' as well. Perhaps that's the syntax error?

User 542 | 7/29/2014, 6:00:34 PM

Oh I see, so it still recreates the entire SArray and replaces it, Just in lambda-form.