Skip to content

Instantly share code, notes, and snippets.

@BinarySpoon
Last active October 23, 2020 10:10
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 BinarySpoon/09f6fe5b77922425038efe02a049ceb8 to your computer and use it in GitHub Desktop.
Save BinarySpoon/09f6fe5b77922425038efe02a049ceb8 to your computer and use it in GitHub Desktop.
# convert to quater -->
def convert_to_qtr(ym):
year, month = ym.split('-')
if month in ['01','02','03']:
result = year + 'q1'
elif month in ['04','05','06']:
result = year + 'q2'
elif month in ['07','08','09']:
result = year + 'q3'
else:
result = year + 'q4'
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment