title: How to add Pandas dataframe column from a element of a list in another column without lambda?
body: <p>Suppose I have this dataframe</p>
  
  <pre><code>A                           B
  [ 'a' , 'b' , 'c' ]         3
  [ 'e' , 'f' , 'g' , 'h']    5
  </code></pre>
  
  <p>How can I create a new column such as below without lambda?</p>
  
  <pre><code>A                                 B   C
  [ 'a' , 'b' , 'c' ]               3   'b'
  [ 'e' , 'f' , 'g' , 'h' ]         5   'g'
  </code></pre>
  
  <p>If using lambda, it will be</p>
  
  <pre><code>df['C'] = df['A'].apply( lambda x : x[-2] )
  </code></pre>
  
  <p>EDIT:
  Example code:</p>
  
  <pre><code>import pandas as pd
  mydata = [ { 'A' : [ 'a' , 'b' , 'c' ] ,       'B' : 3 } ,
             { 'A' : [ 'e' , 'f' , 'g' , 'h' ] , 'B' : 5}]
  df = pd.DataFrame(mydata)
  </code></pre>