I am trying to write some code in python that will split the string in a cell if the cell value contains a certain word.
I have made a sample dataframe to explain the challenge I'm facing.
d = {'Message': [1, 2,3], 'Details': ['I WANT IT ALL', 'HELLO WORLD','NOPE IT IS NOT CORRECT']}
df = pd.DataFrame(data=d)
df
I cant figure out the rest of this code.
d['New Column'] = pd.np.where(d['Details'].str.contains("WANT"),
If column contains "want" the 'New Column' value = 'want all' ELSE other.
Thank you in advance community.