In a pandas dataframe, I want to search row by row for multiple string values. If the row contains a string value then the function will add/print for that row, into an empty column at the end of the df 1 or 0 based upon
There have been multiple tutorials on how to select rows of a Pandas DataFrame that match a (partial) string.
For Example:
import pandas as pd
#create sample data
data = {'model': ['Lisa', 'Lisa 2', 'Macintosh 128K', 'Macintosh 512K'],
'launched': [1983,1984,1984,1984],
'discontinued': [1986, 1985, 1984, 1986]}
df = pd.DataFrame(data, columns = ['model', 'launched', 'discontinued'])
df
I'm pulling the above example from this website: https://davidhamann.de/2017/06/26/pandas-select-elements-by-string/
How would I do a multi-value search of the entire row for: 'int', 'tos', '198'?
Then print into a column next discontinued, a column int that would have 1 or 0 based upon whether the row contained that keyword.