I would need to change label if at least one of data frame's columns contain one of the following words:
check_words=['pit','stop','PIT','STOP','Pit','Stop']
A sample of rows in my dataframe is:
import pandas as pd
import numpy as np
df = pd.DataFrame(np.array([['Ferrari was hit by a radio communication blackout' , 'Scuderia Ferrari trying a double pit stop', ' If Ferrari takes nothing else away from the 2019 season, it must learn from its mistakes across the season'], ['We may use the following original news sources for stories', 'Sebastian Vettel insisted he trusts in Ferrari', 'During the recent Grand Prix of Italy, the Scuderia Ferrari team managed to execute one of the fastest pit stops ever performed during a Formula 1 race']]),
columns=['Text1', 'Short','Data'])
I created a column Label as follows:
df['Label']='No Pit'
to identify if a column contains or does not contain the words in the list above. If it contains a word within that list, then I would need to change label in 'Pit
'.
Could you please tell me how I can change it?