Skip to content

Instantly share code, notes, and snippets.

@masnick
Created March 30, 2016 21:08
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 masnick/abacc6864e76aa22f08e6515c70c12f8 to your computer and use it in GitHub Desktop.
Save masnick/abacc6864e76aa22f08e6515c70c12f8 to your computer and use it in GitHub Desktop.
def icd9_transform(icd9):
l = len(icd9)
if l == 3:
return "%s000" % icd9
elif l == 4:
return "%s00%s" % (icd9[0:3], icd9[-1:])
elif l == 5:
return "%s0%s" % (icd9[0:3], icd9[-2:])
else:
return icd9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment