Skip to content

Instantly share code, notes, and snippets.

@jxnl
Created March 23, 2017 20:47
Show Gist options
  • Save jxnl/cb7ede99be427f6df9ce0b0e6a0e10cc to your computer and use it in GitHub Desktop.
Save jxnl/cb7ede99be427f6df9ce0b0e6a0e10cc to your computer and use it in GitHub Desktop.
t = """
paste transcript
"""
grades = [x for x in t.split("\n\n") if "Y" in x][1:]
grades =[[x for x in y.strip().replace(" ", "_").replace(" ", "_").split("_") if x != ""][:4] for y in grades]
grades = [(x[0], x[-1]) for x in grades if len(x[-1]) == 2]
df = pd.DataFrame(grades, columns=["course_code", "grade"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment