How to run the function passing values from a list?
This is the list as shown below:
keywords = ['car','water','2 bottles']
and a function defined as follows:
def my_func(param):
b = df.loc[df['Field'].str.contains(param), 'User'].tolist()
print (f'\nThe item "{param}" was bought by in User: ', b)
return b
Currently I am doing it manually:
buyer= my_func('car')
buyer= my_func('water')
buyer= my_func('2 bottles')
However, I would like to run a function and print results by iterating param over a list of keywords.