I currently have a dataframe in which for each row, there is a column of comma separated text ordered somewhat randomly (top_categories
) that is then separated out into individual columns (Category 1
, Category 2
, etc) based on their placement within the top_categories
column.
How would I be able to get to my desired output, where each of the categories (Category A, Category B, etc) would be their own column (let's say ordered alphabetically), with a 1 or a 0 to indicate whether or not that specific category exists in that row's top_categories
column?
Any help would be appreciated! (Additionally, I linked sample data in the hyper links above for what my data currently looks like (tab 1), and what I'm trying to achieve (tab 2). Thanks!