[category.split("-")[0].strip() for category in ast.literal_eval(results.loc[0, "predicted_categories"])] # output: ['80814001', '13003106', '80805004', '13003144', '13003195']