title: Pandas - set datetime / Timestamp value with apply
body: <p>Lets consider the following dataframe:</p>
  
  <pre><code>a=pd.DataFrame(data=list(range(10)))
  </code></pre>
  
  <p>Trying to create a new column from it with apply:
  The column is supposed to contain Timestamp object</p>
  
  <pre><code>def test(x):
      x["date"]=pd.Timestamp("2017-01-01")
      return x
  
  a.apply(test,axis=1)
  </code></pre>
  
  <p>However this result in a dataframe containing the <code>.value</code> numerical attribute of the timestamp:</p>
  
  <pre><code>    0   date
  0   0   1483228800000000000
  1   1   1483228800000000000
  2   2   1483228800000000000
  3   3   1483228800000000000
  4   4   1483228800000000000
  5   5   1483228800000000000
  6   6   1483228800000000000
  7   7   1483228800000000000
  8   8   1483228800000000000
  9   9   1483228800000000000
  </code></pre>
  
  <p>How come it is so? How can I get the correct Timestamp in the DataFrame?</p>
  
  <hr>
  
  <p>Edit: here the full code that is giving me problem:
  This is for respondant to understand that i am not trying to set a simply formed list of datetimes to a new column:</p>
  
  <pre><code>def mae(x):
      entry=x.name[0]
      exit=x.name[1]
      m=d.loc[entry:exit,"close"]
      if x.dir==-1:
          r=(m.sub(m[::-1].cummax()[::-1])).abs().max()
          imax=(m.sub(m[::-1].cummax()[::-1])).idxmin()
      elif x.dir==1:
          r=(m.sub(m[::-1].cummin()[::-1])).abs().max()
          imax=(m.sub(m[::-1].cummin()[::-1])).idxmax()   
      else: r=0
      x['mae']=r*gbp['multiplier']
      x['peak']=imax 
      return x
  
  k=g.head().apply(mae,axis=1)
  </code></pre>
  
  <p>This takes as input another dataframe and some financial prices data stored in a database - so a bit difficult to invent an example that at the same time is simple enough for people to grab it quickly and complicated enough as to justify the use of <code>.apply</code>. </p>
  
  <p>I think there is something i dont understand / or a bug in the <code>.apply</code> function - this is what i would like to have input and help on. Thanks guys!</p>