diff --git a/calendarAnalysis.py b/calendarAnalysis.py new file mode 100644 index 0000000..bc27a92 --- /dev/null +++ b/calendarAnalysis.py @@ -0,0 +1,65 @@ +import plotly +import plotly.plotly as py +import pandas as pd +import xlrd +import plotly.graph_objs as go + + +''' +Cole's plots every category quantity over time + +Mine: Checks to see if same location at same time. +- Raises warnings if they are very similar +- Raises alert if they are the same. + +Example locations + +Olin 149 +Waverly, Iowa - Prairie Links Golf Course +Larson Meeting Room (WCC236) +Weitz Cinema +Building name +Room name +Leighton #305 +TBD + +Runs through year and saves location of each new event in a new list, along with it's id? +If the location matches a list already made, then it checks the times of the two IDs, and reports if they match +Doesn't leave wiggle room in location names + + +''' + +# Create random data with numpy +import numpy as np + +plotly.tools.set_credentials_file(username="CaptainCrouton89", api_key="QpQSb4FSQnuzS0q5DOSS") + +calendarEventsDF = pd.read_excel("yearData.xlsx", skiprows = 0) + +""" +Takes in start and end times and returns list of all numbers between those times +""" +def findHours(startTime, endTime): + return [i for i in range(int(startTime.strip("0").strip(":")), int(endTime.strip("0").strip(":"))+1)] + +print(findHours("03:00", "11:00")) + +for index, row in calendarEventsDF.itterows() + + +''' +N = 500 +random_x = np.linspace(0, 1, N) +random_y = np.random.randn(N) + +# Create a trace +trace = go.Scatter( + x = random_x, + y = random_y +) + +data = [trace] + +py.plot(data, filename='basic') +''' diff --git a/calendarBuilder.py b/calendarBuilder.py index 4384e61..54eeadc 100644 --- a/calendarBuilder.py +++ b/calendarBuilder.py @@ -5,6 +5,9 @@ IMPORTANT: WILL CLEAR ALL EVENTS ON WHATEVER CALENDAR IT IS USED ON ******************************************************************* + +Author: Silas Rhyneer + Imports calendar data from an excel sheet and exports it to user's choice of google calendars. It wipes the calendar, and then uploads all of the excel sheet. """ @@ -64,7 +67,7 @@ def insertYearEvents(service, creds, name, location, description, date, startTim def main(): - calendarEventsDF = pd.read_excel("yearData.xlsx", skiprows = 0) + calendarEventsDF = pd.read_excel("yearData.xls", skiprows = 0) creds = None # The file token.pickle stores the user's access and refresh tokens, and is diff --git a/converter.py b/converter.py index 78b6eb3..df7f2d0 100644 --- a/converter.py +++ b/converter.py @@ -8,13 +8,39 @@ import xlwt import xlrd -f = open('text.txt', 'r') +import os +directory = 'data' +header = ["name", "date", "link", "startTime", "stopTime", "location", "description", "category"] -header = ["name", "date", "link", "startTime", "stopTime", "location", "description"] +try: + os.remove("yearData.xls") +except: + pass +""" +Compiles all files onto one .txt file +""" +with open('backSlashFile.txt', 'w') as outfile: + for filename in os.listdir(directory): + if filename.endswith(".txt"): + with open(directory + "/" + filename) as infile: + for line in infile: + outfile.write(line) +outfile.close() + +with open('backSlashFile.txt', 'r') as infile: + with open('allData.txt', 'w') as outfile: + for line in infile: + outfile.write(line.replace("\\", "")) + +f = open('allData.txt', 'r') row_list = [] for row in f: - row_list.append(i.replace("#", "").strip(" am").strip(" pm") for i in row.split(",")) + # row_list.append(i.replace("#", "").strip("am").strip("pm").strip(" ") for i in row.split(",")) + thisRow = [i for i in row.split(",")] + #thisRow[4] = function(thisRow[4]) + #thisRow[5] = function(thisRow[5]) + row_list.append(thisRow) column_list = zip(*row_list) workbook = xlwt.Workbook() worksheet = workbook.add_sheet('Sheet1') @@ -29,5 +55,5 @@ for item in range(len(column)): print(column[item]) worksheet.write(item+1, i, column[item]) - workbook.save('Excel.xls') + workbook.save('yearData.xls') i+=1 diff --git a/token.pickle b/token.pickle new file mode 100644 index 0000000..41c1424 Binary files /dev/null and b/token.pickle differ