Настройте свои условия и выходы и сохраните в списках:
a = df['class'].eq(7)
b = df['class'].eq(8)
c = df['class'].isin([1,2])
helper = df['class'].isin([4,5,6]) & (df.industry.isin(range(170, 491)) | df.industry.isin(range(570, 691)))
d = helper & df.occupation.ge(1000)
e = helper & df.occupation.isin(range(10, 3541))
conds = [a, b, c, d, e]
outs = ['QWE', 'ASD', 'ZXC', 'IOP', 'JKL']
Используйте np.select
. Просто отметьте, что у вас есть перекрывающиеся условия, поэтому существует вероятность неоднозначности между IOP
и JKL
df['out'] = np.select(conds, outs, default='BNM')
industry class occupation value out
0 170 4 1000 123.3 IOP
1 180 7 3600 4543.8 QWE
2 570 5 990 657.4 JKL