pandas - How to Add a New Column With Selected Values from Another Column In Python -
i have been trying figure out day. new python.
i have table 50,000 records. table below explain trying do.
i add third column called category. column contain values based results conditions set on movies column.
----------------------------------------- n | movies ----------------------------------------- 1 | save last dance ----------------------------------------- 2 | love , other drugs --------------------------------------- 3 | dance me --------------------------------------- 4 | love --------------------------------------- 5 | high school musical ----------------------------------------
the condition this; search through movies column these words {dance, love, , musical). if word found in string, return word in category column.
this produce new dataframe @ end;
----------------------------------------- n | movies | category ----------------------------------------- 1 | save last dance | dance ----------------------------------------- 2 | love , other drugs | love --------------------------------------- 3 | dance me | dance --------------------------------------- 4 | love | love --------------------------------------- 5 | high school musical | musical ----------------------------------------
thanks in advance!!