Skip to content

Instantly share code, notes, and snippets.

@blbradley
Last active August 29, 2015 14:14
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 blbradley/8bf8c4346f6acccae999 to your computer and use it in GitHub Desktop.
Save blbradley/8bf8c4346f6acccae999 to your computer and use it in GitHub Desktop.
pandas 'Is a Timestamp within a Period?'
from pandas.core.api import Timestamp, Period
time_in_seconds = Timestamp('2013-03-31 22:11:19')
one_year_period = Period('2013')
time_in_seconds.to_period(one_year_period.freq) == one_year_period
# True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment