Python Pandas Series of Datetimes to Seconds Since the Epoch
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Following in the spirit of this answer , I attempted the following to convert a DataFrame column of datetimes to a column of seconds since the epoch. df['date'] = (df['date']+datetime.timedelta(hours=2)-datetime.datetime(1970,1,1)) df['date'].map(lambda td:td.total_seconds()) The second command causes the following error which I do not understand. Any thoughts on what might be going on here? I replaced map with apply and that didn't help matters. --------------------------------------------------------------------------- AttributeError