title: Pandas - 'Series' object has no attribute
body: <p>I need to use a lambda function to do a row by row computation. For example create some dataframe</p>
  <pre><code>import pandas as pd
  import numpy as np
  
  def myfunc(x, y):
      return x + y
  
  colNames = ['A', 'B']
  data = np.array([np.arange(10)]*2).T
  
  df = pd.DataFrame(data, index=range(0, 10), columns=colNames)
  </code></pre>
  <p>using 'myfunc' this does work</p>
  <pre><code>df['D'] = (df.apply(lambda x: myfunc(x.A, x.B), axis=1))
  </code></pre>
  <p>but this second case does not work!</p>
  <pre><code>df['D'] = (df.apply(lambda x: myfunc(x.colNames[0], x.colNames[1]), axis=1))
  </code></pre>
  <p>giving the error</p>
  <pre><code>AttributeError: (&quot;'Series' object has no attribute 'colNames'&quot;, u'occurred at index 0')
  </code></pre>
  <p>I really need to use the second case (access the colNames using the list) which gives an error, any clues on how to do this?</p>