title: Most efficient way to create dataframe based on another one
body: <p>I have dataframe like this</p>
  <pre><code>A     Type    B    C    D 
  Train   X     23   230  22
  Car     Y     0    2    500
  Judge   Z     222  1    600
  </code></pre>
  <p>Is it possible to create a new DF based on the values in the row?</p>
  <p>I have the following function:</p>
  <pre><code>def quant(x):
      if x&gt;0:
          return 1
      else:
          return 0
  </code></pre>
  <p>Which I then want to apply on some columns of the df</p>
  <pre><code>df.apply(lambda row: quant(row[['B','C', 'D']]), axis=1, result_type='expand')
  </code></pre>
  <p>To create new columns with the mapped values based on the function</p>
  <pre><code>A      Type  B_mapped C_mapped D_mapped
  Train    X    1    1     1
  Car      Y    0    1     1
  Judge    Z    1    1     1
  </code></pre>
  <p>However my code returns the following error:</p>
  <pre><code>ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
  </code></pre>
  <p>What is the most efficient way to kind of map columns in this way?</p>