Created
December 15, 2018 00:28
-
-
Save gwsu2008/5c3fcf01c1b76b57a08bba3d2294bade to your computer and use it in GitHub Desktop.
python-date-quarterly.py
This file contains hidden or 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
mport pandas as pd | |
from datetime import datetime | |
No_of_quarters=8 | |
#today = datetime.date.today() | |
today = datetime(2019, 1, 11) | |
month = pd.Period(today, freq='M') | |
quarter = month.asfreq('Q-DEC') | |
print(type(quarter)) | |
print("Quarters:") | |
#yearly_quarters = [str(quarter-x)[:-2] for x in range (0,No_of_quarters)] | |
yearly_quarters = [str(quarter-x)[-2:] for x in range (0,No_of_quarters)] | |
print(yearly_quarters) | |
#print("Months:") | |
#for x in range (0,(No_of_quarters*3)): | |
# print(month-x) | |
#prng = pd.period_range('01/01/2017', today, freq='Q') | |
#print(prng) | |
#print(str(prng[0])) | |
#print(type(prng[0])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment