New to Python Data Science
The below is my Raw_data
raw_data = {'var1': ['true','false','ture'],'var2': [10,20,50], 'var3':['eggs','milk','eggs']}
df = pd.DataFrame(raw_data, columns = ['var1','var2','var3'])`
Expermented code but not working
def my_fun (var1,var2,var3,var4):
df[var4]= np.where((df[var1] == 'true',
df[var3] == 'eggs',
df[var2] < 10),
'hello',
'zello')
return df
Here I like to use var1, var2 and var3 conditions and get the conditional result. Please help
TrueandFalseinstead of"true"and"false".Trueinstead of"ture"