title: Applying function to a merged dataset and getiing error
body: <p>I had two data sets, one in <code>data1</code> and other is <code>data2</code>. I merged two data sets by using </p>
  
  <pre><code>data = pandas.concat([data1, data2])
  </code></pre>
  
  <p><code>data1</code> and <code>data2</code> are same and it is like:</p>
  
  <pre><code>     Loan_ID Gender Married Dependents     Education Self_Employed  \
  0  LP001002   Male      No          0      Graduate            No   
  1  LP001003   Male     Yes          1      Graduate            No  
  2  LP001005   Male     Yes          0      Graduate           Yes   
  3  LP001006   Male     Yes          0  Not Graduate            No   
  
     ApplicantIncome  CoapplicantIncome  LoanAmount  Loan_Amount_Term  \
  0             5849                0.0         NaN             360.0   
  1             4583             1508.0       128.0             360.0   
  2             3000                0.0        66.0             360.0   
  3             2583             2358.0       120.0             360.0   
  
     Credit_History Property_Area Loan_Status  
  0             1.0         Urban           Y  
  1             1.0         Rural           N  
  2             1.0         Urban           Y  
  3             1.0         Urban           Y  `
  </code></pre>
  
  <p>I created one method:</p>
  
  <pre><code>def treat_outlier(x):
      a,b = data[x].quantile([.25,.75])
      IQR = b-a
      for i in range(len(data[x])):
          if(data[x][i]&lt;a-(1.5*IQR) or (data[x][i]&gt;b+(1.5*IQR))):
              data[x][i] = data[x].median()
  </code></pre>
  
  <p>when I individually applied this method to <code>data1</code> and <code>data2</code>, this function was working, but when I applied it to the merged data set <code>data</code>, I got the error:</p>
  
  <blockquote>
    <p>The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()</p>
  </blockquote>
  
  <p>Why is that so?</p>