title: Python: Apply .apply() with a self-defined function to a Data Frame- why doesn't it work?
body: <p>I am trying to apply a self-defined function by using apply() to a data frame. Goal is to calculate the mean of each row  / column with a self-defined function. But it doesn't work, probably I still don't understand the logic of .apply() fully. Can someone help me? Thanks in advance:</p>
  <pre><code>d = pd.DataFrame({&quot;A&quot;:[50,60,70],&quot;B&quot;:[80,90,100]})
  
  def m(x):
      x.sum()/len(x)
      return x
  
  d.apply(m(),axis=0)
  </code></pre>