AttributeError: 'Timestamp' object has no attribute 'timestamp
<p>While converting a <code>panda</code> object to a timestamp, I am facing this strange issue.</p>

<p>Train['date'] value is like <code>01/05/2014</code> which I am trying to convert into linuxtimestamp.</p>

<p>My code:</p>

<pre><code>Train = pd.read_csv("data.tsv", sep='\t') # use TAB as column separator
Train['timestamp'] = pd.to_datetime(Train['date']).apply(lambda a: a.timestamp())
</code></pre>

<p>And I get this error:</p>

<pre><code>Traceback (most recent call last):
  File "socratis.py", line 11, in &lt;module&gt;
    Train['timestamp'] = pd.to_datetime(Train['date']).apply(lambda a: a.timestamp())
  File "/home/ubuntu/.local/lib/python2.7/site-packages/pandas/core/series.py", line 2220, in apply
    mapped = lib.map_infer(values, f, convert=convert_dtype)
  File "pandas/src/inference.pyx", line 1088, in pandas.lib.map_infer (pandas/lib.c:62658)
  File "socratis.py", line 11, in &lt;lambda&gt;
    Train['timestamp'] = pd.to_datetime(Train['date']).apply(lambda a: a.timestamp())
AttributeError: 'Timestamp' object has no attribute 'timestamp'
</code></pre>

<p>The method to_datetime will return a <code>TimeStamp</code> instance.  I'm not sure what you are hoping to accomplish by the lambda function, but it appears you are trying to convert some object to a <code>TimeStamp</code>. </p>

<p>Try removing the apply section so it looks like this:</p>

<p><code>Train['timestamp'] = pd.to_datetime(Train['date'])</code></p>

python time timestamp