Skip to content

Instantly share code, notes, and snippets.

@mihirs16
Last active July 4, 2020 03:37
Show Gist options
  • Save mihirs16/2df7717c2a8f74181ee9ff8c5cefdcb5 to your computer and use it in GitHub Desktop.
Save mihirs16/2df7717c2a8f74181ee9ff8c5cefdcb5 to your computer and use it in GitHub Desktop.
To convert a .csv stored string representing a list to a python list
def func(raw_tags):
tags_clean = raw_tags[1:-1].split(", ")
return tags_clean
df['tags'] = df['tags'].apply(lambda x: func(x))
print(type(df.tags[0]))
df.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment