Convert pandas DateTimeIndex to Unix Time?

后端 未结 6 1637
故里飘歌
故里飘歌 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 07:13

    Complementing the other answers: //10**9 will do a flooring divide, which gives full past seconds rather than the nearest value in seconds. A simple way to get more reasonable rounding, if that is desired, is to add 5*10**8 - 1 before doing the flooring divide.

提交回复
热议问题