I have a problem with the type of one of my column in a pandas dataframe. Basically the column is saved in a csv file as a string, and I wanna use it as a tuple to be able t
You can use ast.literal_eval, which will give you a tuple:
ast.literal_eval
import ast df.LABELS = df.LABELS.apply(ast.literal_eval)
If you do want a list, use:
df.LABELS.apply(lambda s: list(ast.literal_eval(s)))