Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainCrouton89 authored Apr 14, 2019
1 parent c8b784e commit 8e7df54
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 5 deletions.
65 changes: 65 additions & 0 deletions calendarAnalysis.py
Original file line number Diff line number Diff line change
@@ -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')
'''
5 changes: 4 additions & 1 deletion calendarBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down Expand Up @@ -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
Expand Down
34 changes: 30 additions & 4 deletions converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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
Binary file added token.pickle
Binary file not shown.

0 comments on commit 8e7df54

Please sign in to comment.