Created
May 28, 2016 22:09
-
-
Save cpard/e8b5282cfbf0d7fa316a5b12125c9669 to your computer and use it in GitHub Desktop.
Find out in which part of the day the event occured
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
padas.concat([joinedEventsFrame,padas.DataFrame(padas.DatetimeIndex(joinedEventsFrame['timestamp']).hour,index = joinedEventsFrame.index, columns=['hours'])],axis=1) | |
def occuredAt(time): | |
result = np.nan | |
if time >=9 and time <= 17: | |
result = 'during' | |
elif time >= 0 and time < 9: | |
result = 'before' | |
elif time > 17 and time <24: | |
result = 'after' | |
return result | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment