擅长:python、mysql、java
<pre><code>df['Time'] = (df['Time'] - pd.Timestamp("1970-01-01")) // pd.Timedelta('1s')
</code></pre>
<p>是熊猫推荐的解决方案,<a href="https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html?highlight=Epoch" rel="nofollow noreferrer">reference</a>。在</p>
<p>示例:</p>
^{pr2}$
<p>输出:</p>
<pre><code> Time Epoch
0 2012-10-08 18:15:05 1349720105
1 2012-10-09 18:15:05 1349806505
2 2012-10-10 18:15:05 1349892905
3 2012-10-11 18:15:05 1349979305
</code></pre>