Skip to content

Instantly share code, notes, and snippets.

@theSekyi
Created August 28, 2019 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theSekyi/dfb2b86eabd6c902510e34e85e5742f9 to your computer and use it in GitHub Desktop.
Save theSekyi/dfb2b86eabd6c902510e34e85e5742f9 to your computer and use it in GitHub Desktop.
def static_features(t0):
"""Get features such as current weekday and time
"""
weekday = t0.dt.dayofweek
return weekday
t0 = pd.to_datetime('2019-01-07 06:05:00')
a = static_features(t0)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-267-884bb83e94ca> in <module>
----> 1 a = static_features(t0)
<ipython-input-265-bf9b2bc64178> in static_features(t0)
4 """Get features such as current weekday and time
5 """
----> 6 weekday = t0.dt.dayofweek
7
8 return weekday
AttributeError: 'Timestamp' object has no attribute 'dt'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment