Skip to content

Instantly share code, notes, and snippets.

@ebongzzang
Created November 8, 2018 03:30
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 ebongzzang/9253d59db0bcb209770001ab1b6543da to your computer and use it in GitHub Desktop.
Save ebongzzang/9253d59db0bcb209770001ab1b6543da to your computer and use it in GitHub Desktop.
create bulk yyyymm
def create_yearmonth_list(start_year:int, end_year: int):
start_at = start_year * 100
end_at = end_year - start_year
for year in range(0,end_at+1):
year_acc = year*100
start = start_at + year_acc
for month in range(1,13):
yyyymm = start+month
yield yyyymm
list(create_yearmonth_list(1998,2001))
"""
[199801,
199802,
199803,
199804,
199805,
199806,
199807,
199808,
199809,
199810,
199811,
199812,
199901,
199902,
199903,
199904,
199905,
199906,
199907,
199908,
199909,
199910,
199911,
199912,
200001,
200002,
200003,
200004,
200005,
200006,
200007,
200008,
200009,
200010,
200011,
200012,
200101,
200102,
200103,
200104,
200105,
200106,
200107,
200108,
200109,
200110,
200111,
200112,
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment