Look at a dataframe and a variable and return a set of clients which are in both the infolist and dataframe, and:
Any client in infolist with membership fee larger than "Offer-Price"
Any client in infolist who "Feedback" is 0.2 (or higher)
Example dataframe:
df = pd.DataFrame({'Client': ['A','B','C'], 'Offer-Price':[90,6591,8000], 'Feedback': [0.1, 0.2,0.1]})
Client Offer-Price Feedback
0 A 90 0.1
1 B 6591 0.2
2 C 8000 0.1
'infolist':
infolist = [('A', 80.0), ('C', 3900.0)]
Expected outcome:
Client C
Code tried so far: Not sure why this isn't working after tons of research.
def testfunction(df, infolist):
df = np.where((df['Client']== infolist[x[0]]) & (df['Feedback']>= 0.2) | (infolist[x[1]] >= df['Offer-Price']))
return df