title: Pandas/Python create columns based on multiple conditions with a dictionary
body: <p>I am looking for a shorter and more elegant way of writing the condition below, let's say I have 30 different combinations. Is it possible to map some kind of dictionary with multiple conditions or something else?</p>
  <pre><code>def set_name(df):
      if df['PRODUCT'] == 'A' and df['TYPE'] == 'C2':
          return 'AAC2'
      elif df['PRODUCT'] == 'A' and df['TYPE'] == 'C3':
          return 'AAC3'
      elif df['PRODUCT'] == 'B' and df['TYPE'] == 'C2':
          return 'BBC&quot;'
      
  df['RETURN'] = df.apply(set_name, axis=1)
  </code></pre>
  <p>Another way is the below which still pretty long if I have many combinations.</p>
  <pre><code>conditions = [
      (df['PRODUCT'] == 'A') &amp; (df['TYPE'] == 'C2'),
      (df['PRODUCT'] == 'A') &amp; (df['TYPE'] == 'C3')
  ]
  
  values = ['AAC2', 'AAC3']
  
  df['RETURN'] = np.select(conditions, values)
  </code></pre>