Using the code below I need to place the values ("Right Data, Incorrect Data...) into a column "Assessment" when the if condition satisfies based on x and y values. But I am getting the below error
AttributeError: 'DataFrame' object has no attribute 'map'
def variable(x,y):
x = df['Volume']
y = df['Turnover']
if df[(x==0) & (y==0)]:
return 'Right Data'
if df[(x>0) & (y>0)]:
return 'Right Data'
if df[(x<0) & (y<0)]:
return 'Right Data'
if df[(x>0) & (y<0)]:
return 'Incorrect Data'
if df[(x<0) & (y>0)]:
return 'Incorrect Data'
if df[(x!=0) & (y==0)]:
return 'Incorrect Data'
if df[(x==0) & (y!=0)]:
return 'Incorrect Data'
if df[(x==0) & (y.isnull())]:
return 'Missing Data'
if df[(x=='Nan') & (y!=0)]:
return 'Missing Data'
test = df[['Volume','Turnover']]
test2 = test.map(variable)
df['Assessment'] = test2