
Want to find which time period contains a Python Pandas datetime? Use to_period:
pd.Timestamp.now().to_period('1D')
pd.Timestamp.now().to_period('6W')
This returns a Pandas “Period” object, useful (among other things) for checking if two dates are within the same period.
