Last active
September 25, 2018 20:42
-
-
Save AO8/b3842815dafce63b4f143cfdbde6cf20 to your computer and use it in GitHub Desktop.
Read CSV exported from Calendly to analyze what months students book an advising appointment. More concise version using dict as central data structure.
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
| import csv | |
| import matplotlib.pyplot as plt | |
| months = { | |
| "january" : 0, | |
| "february" : 0, | |
| "march" : 0, | |
| "april" : 0, | |
| "may" : 0, | |
| "june" : 0, | |
| "july" : 0, | |
| "august" : 0, | |
| "september" : 0, | |
| "october" : 0, | |
| "november" : 0, | |
| "december" : 0 | |
| } | |
| with open("dashboard-export.csv") as csv_file: | |
| csv_reader = csv.reader(csv_file) | |
| headings = next(csv_reader) | |
| for row in csv_reader: | |
| if row[6][0:2] == "1/": | |
| months["january"] += 1 | |
| if row[6][0:2] == "2/": | |
| months["february"] += 1 | |
| if row[6][0:2] == "3/": | |
| months["march"] += 1 | |
| if row[6][0:2] == "4/": | |
| months["april"] += 1 | |
| if row[6][0:2] == "5/": | |
| months["may"] += 1 | |
| if row[6][0:2] == "6/": | |
| months["june"] += 1 | |
| if row[6][0:2] == "7/": | |
| months["july"] += 1 | |
| if row[6][0:2] == "8/": | |
| months["august"] += 1 | |
| if row[6][0:2] == "9/": | |
| months["september"] += 1 | |
| if row[6][0:2] == "10": | |
| months["october"] += 1 | |
| if row[6][0:2] == "11": | |
| months["november"] += 1 | |
| if row[6][0:2] == "12": | |
| months["december"] += 1 | |
| total = 0 | |
| for v in months.values(): | |
| total += v | |
| for k,v in months.items(): | |
| print(f"{k} = {v}") | |
| print(f"\ntotal = {total}") | |
| appointments = [key for key in months.keys()] | |
| values = [value for value in months.values()] | |
| plt.plot(values, color="green") | |
| plt.ylabel("Number of Appts Booked", weight="bold", size="large") | |
| plt.xticks(range(len(values)), appointments, rotation=50, horizontalalignment="right", weight="bold", size="large") | |
| plt.yticks(weight="bold", size="large") | |
| plt.title("What months student booked a BAS-SD advising appt with AO: July 2017 to PRESENT", size="large", weight="bold") | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment