title: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()',
body: <p>when I use pandas.DataFrame.apply,it shows "The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  df=pd.DataFrame(np.random.randn(50,2))
  
  def fun(df):
      median=df.median()
      mad=(df-median).median()
      if df&gt;(median+3.1483*mad):
          df=median+3.1483*mad
      elif df&lt;(median-3.1483*mad):
          df=median-3.1483*mad
      return df
  df.apply(fun)
  </code></pre>