Skip to content

Instantly share code, notes, and snippets.

@LittleWat
Last active January 2, 2016 14:17
Show Gist options
  • Save LittleWat/ef5372df6502d5ac888c to your computer and use it in GitHub Desktop.
Save LittleWat/ef5372df6502d5ac888c to your computer and use it in GitHub Desktop.
pandasでunix時刻をdatetime型に変更する際の注意事項 ref: http://qiita.com/LittleWat/items/c7cf5c3276e1d5e25d66
df["time"] = pd.to_datetime(df.index , unit="ms")
df["time2"] =df.index
df["time3"] = df.time2.apply(lambda x: datetime.fromtimestamp(x/1000))
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-117-0c598f05317f> in <module>()
----> 1 df["time3"] = df.index.apply(lambda x: datetime.fromtimestamp(x/1000))
AttributeError: 'Int64Index' object has no attribute 'apply'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment