You should use the apply API DataFrame method:
df['uids'] = df.apply(lambda row: set(row['uids']), axis=1)
or
df = df['uids'].apply(set)
You can find more information on the application method here .
Examples of using
df = pd.DataFrame({'A': [[1,2,3,4,5,1,1,1], [2,3,4,2,2,2,3,3]]})
df = df['A'].apply(set)
Output:
>>> df
0 set([1, 2, 3, 4, 5])
1 set([2, 3, 4])
Name: A, dtype: object
Or:
>>> df = pd.DataFrame({'A': [[1,2,3,4,5,1,1,1], [2,3,4,2,2,2,3,3]]})
>>> df['A'] = df.apply(lambda row: set(row['A']), axis=1)
>>> df
A
0 set([1, 2, 3, 4, 5])
1 set([2, 3, 4])