Here's what my data frame look like:
Number Age Famous_for
1 35 "businessman chairman of IBM (1973–1981)"
2 42 "musician (House of Freaks Gutterball)"
3 87 "baseball player (Oakland Athletics)"
I want to create additional column that will contain a dummy variable whether or not person was involved with entertaining business. Something like that:
Number..Age..................Famous_for.....................Entertaining
1.......35.......businessman chairman of IBM (1973–1981)........0
2.......42.......musician (House of Freaks Gutterball)..........1
3.......87.......baseball player (Oakland Athletics)............0
How do I create a column based on the certain words in the famous for column (such as "musician", "club", "actor" and etc)? I tried the following:
df['entertaining'] = np.where(df['famous_for']>="musician", 1, 0)
but it wouldn't work. How can I do this in Python?