I am working with a Pandas DataFrame that has a column of entries in arrays, such as the following example:
user_id tags
0 1 [a,b,c]
1 2 [a,b,d]
2 3 [b,c]
...
n n [a,d]
I have some tag ids that correlate to the simplified tags in a JSON object and am trying to replace the entries with their non-simplified variants with the following method:
for user_tags in dataset['tags']:
for tag in user_tags:
for full_tag in UUIDtags['tags_full']:
if full_tag['id'] == tag:
tag = entry['name']
id and name are corresponding simplified tags and full tag names in the JSON object.
However, this does not change the value upon execution; is there a Pandas method that I am missing to replace these values? I am afraid that I will replace the entire array rather than replace the individual entries.
Thank you!
EDIT: An example of what the JSON object (UUIDtags) contains.
{
"tags_full": [{
"id": "a",
"name": "Alpha"
}, {
"id": "b",
"name": "Beta"
....
full_tandUUIDtagslook like? It's hard to test ideas with access to only half the info...