I have data like:
df =
id1, id2, string
1, [2], 'foo'
2, [3], 'bar'
3, [4], 'baz'
I'd like to replace id2 with the value from the array.
Here is what I've tried:
x = df['id2'].map(lambda x : x[0])
With the hopes of x being a series with the values I want that I can column bind to my DF. What actually happens is that it errors out with an IndexError. In that case I made a function to apply, in place of the lambda function, so that it could except the error, but this returned all nulls.
Seems like this should be straight forward, but I haven't been able to figure it out even after sleeping on it.