I want to create a new column - 'result', and in that column the value will be stored based on the condition below. my conditions is -
1-col emp is 'salaried' or 'business' & col inc is '> 10 lakh' & col flg is 'stp' then add a column result with value 'no_issue'
2-col emp is 'salaried' or 'business' & col inc '<= 10 lakh' & col flg is 'n_stp' then put 'no_issue' in result
3-col emp is 'salaried' or 'business' & col inc '> 10 lakh' & col flg is 'n_stp' then put 'issue' in result
4-col emp is 'salaried' or 'business' & col inc '<= 10 lakh' & col flg is 'stp' then put 'issue' in result
5-col emp is 'other' & col flg is 'n_stp' then put 'no issue' in result
6-col emp is 'other' & col flg is 'stp' then put 'issue' in result
This is a very complex logic, Please help me to get the desired output
my final data with added column looks like -
import pandas as pd
data = [['1', 'stp', 'salaried', '> 10 lakh', 'no_issue'],
['2', 'stp', 'business', '> 10 lakh', 'no_issue' ],
['3', 'n_stp', 'salaried', '<= 10 lakh', 'no_issue']]
df= pd.DataFrame(data, columns = ['s.no', 'flg', 'emp', 'inc', 'result'])
df
s.no flg emp inc result
1 stp salaried > 10 lakh no_issue
2 stp business > 10 lakh no_issue
3 n_stp salaried <= 10 lakh no_issue