I have a dataset like:
df["movie"]
A
B
C
D
How to add another columns["genre"] with randomly assigned values from given list?
genres = ["action", "drama", "comedy"]
so that my df would look like:
movies genre
A action
B drama
C drama
D comedy
...
i've tried:
def addGenreColumn():
for line in data:
data["genre"] = random.choice(['action', 'comedy', 'drama'])
addGenreColumn()
but it will assign only one value from the list, like all 'action's or all 'comedy's. What is the proper way of dealing with that?