Convert pandas DateTimeIndex to Unix Time?

后端 未结 6 1635
故里飘歌
故里飘歌 2020-11-28 06:22

What is the idiomatic way of converting a pandas DateTimeIndex to (an iterable of) Unix Time? This is probably not the way to go:

[time.mktime(t.timetuple()         


        
6条回答
  •  自闭症患者
    2020-11-28 06:58

    A summary of other answers:

    df[''].astype(np.int64) // 10**9
    

    If you want to keep the milliseconds divide by 10**6 instead

提交回复
热议问题