Python pandas to_datetime vs datetime fromtimestamp

Python pandas to_datetime vs datetime fromtimestamp,python,pandas,datetime,Python,Pandas,Datetime,我有以下代码,这意味着fromtimestamp和to_datetime的工作方式不同: import pandas as pd from datetime import datetime pd.to_datetime(1488286965000,unit='ms') >>> Timestamp('2017-02-28 13:02:45') datetime.fromtimestamp(1488286965000/1e3) >>> datetime.date

我有以下代码,这意味着
fromtimestamp
to_datetime
的工作方式不同:

import pandas as pd
from datetime import datetime

pd.to_datetime(1488286965000,unit='ms')
>>> Timestamp('2017-02-28 13:02:45')
datetime.fromtimestamp(1488286965000/1e3)
>>> datetime.datetime(2017, 3, 1, 0, 2, 45)
当我去看的时候,熊猫的版本似乎是正确的

  • 是否有理由
    datetime
    版本给出不同的答案
  • 这也可能是一个bug吗

  • 它只是使用了一个不同的时区。请尝试
    datetime.fromtimestamp(1488286965000/1e3,tz=timezone.utc)
    …您是否位于GMT+11时区?:)
    to_datetime
    fromtimestamp
    具有不同的默认时区。您需要在
    fromtimestamp
    @deceze中指定UTC您想将其作为一个答案,以便我可以接受它吗?