business_id categories
1K4qrnfyzKzGgJPBEcJaNQ ['Tiki Bars', 'Nightlife', 'Mexican', 'Restaurants', 'Bars']
dTWfATVrBfKj7Vdn0qWVWg ['Restaurants', 'Chinese', 'Food Court']
This is how my data frame looks like. The second column has a list as each value.
I am currently using this code but it doesn't work and gives me an error below:
categorical_data = pd.DataFrame()
for i in range(len(data)):
for j in range(len(data.iloc[i][1])):
categorical_data = pd.concat(data.iloc[i][0], data.iloc[i][1][j])
TypeError: first argument must be an iterable of pandas objects, you passed an object of type "str"
Is there a way where I can add the list of categories to the same restaurant? I've tried using the 'get_dummies' but it's not able to split the lists and encode them.