Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
diiannic authored Apr 14, 2019
1 parent b356dd5 commit a297055
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
14 changes: 7 additions & 7 deletions analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import plotly.graph_objs as go
plotly.tools.set_credentials_file(username='colejump', api_key='Mh3sATfsUKQtelXlZTNP')

df = pd.read_excel("yearData.xls")
df = pd.read_excel("Book.xlsx")

#counts the number of events for each day
numberCategoryPerDay = {}
Expand All @@ -19,18 +19,18 @@
count = count + 1
for i in range(count):
if (df.iloc[i][1]) in numberPerDay:
numberPerDay[(df.iloc[i][2])] = numberPerDay[(df.iloc[i][2])] + 1
numberPerDay[(df.iloc[i][1])] = numberPerDay[(df.iloc[i][1])] + 1
else:
numberPerDay[(df.iloc[i][2])] = 1
categoryList = df.iloc[i][9].split("; ")
numberPerDay[(df.iloc[i][1])] = 1
categoryList = df.iloc[i][9].split(",")
for x in categoryList:
if (x) in numberCategoryPerDay:
if (df.iloc[i][1]) in numberCategoryPerDay[x]:
numberCategoryPerDay[x][(df.iloc[i][2])] = numberCategoryPerDay[x][(df.iloc[i][2])] + 1
numberCategoryPerDay[x][(df.iloc[i][1])] = numberCategoryPerDay[x][(df.iloc[i][1])] + 1
else:
numberCategoryPerDay[x][(df.iloc[i][2])] = 1
numberCategoryPerDay[x][(df.iloc[i][1])] = 1
continue
numberCategoryPerDay[x] = {df.iloc[i][2] : 1}
numberCategoryPerDay[x] = {df.iloc[i][1] : 1}

for x, y in numberPerDay.items():
xValues.append(x)
Expand Down
24 changes: 12 additions & 12 deletions analysis2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import plotly.graph_objs as go
plotly.tools.set_credentials_file(username='colejump', api_key='Mh3sATfsUKQtelXlZTNP')

df = pd.read_excel("yearData.xls")
df = pd.read_excel("Book.xlsx")

#counts the number of events for each day
totalDayEvents = {}
Expand All @@ -18,12 +18,12 @@
for index, row in df.iterrows():
count = count + 1
for i in range(count):
if (str(df.iloc[i][2])) in numberPerDay:
start = df.iloc[i][4]
if (str(df.iloc[i][1])) in numberPerDay:
start = df.iloc[i][2]
startList = str(start).split(":")
startHour = startList[0]
startHour = int(startHour)
end = df.iloc[i][5]
end = df.iloc[i][3]
endList = str(end).split(":")
endHour = endList[0]
endHour = int(endHour)
Expand Down Expand Up @@ -54,7 +54,7 @@
print(numberPerDay)
numberPerDay = {}
else:
currentDayList = str(df.iloc[i][2]).split(" ")
currentDayList = str(df.iloc[i][1]).split(" ")
currentDay = currentDayList[0]
tmp = []
for j in numberPerDay:
Expand All @@ -63,7 +63,7 @@
if (k == tmp[0]):
numberPerDay.pop(str(k))
continue
if (k == str(df.iloc[i][2])):
if (k == str(df.iloc[i][1])):
numberPerDay[k] = numberPerDay.pop(str(k))
continue
if (len(str(k)) == 1):
Expand All @@ -76,27 +76,27 @@
numberPerDay = {}
numberPerDay[str(df.iloc[i][1])] = 0
numberPerDay.update(dayTemplate)
start = df.iloc[i][4]
start = df.iloc[i][2]
startList = str(start).split(":")
startHour = startList[0]
startHour = int(startHour)
end = df.iloc[i][5]
end = df.iloc[i][3]
endList = str(end).split(":")
endHour = endList[0]
endHour = int(endHour)
while (endHour != startHour and endHour >= 0):
numberPerDay[str(endHour)] = numberPerDay[str(endHour)] + 1
if (endHour == 0):
numberPerDay[str(df.iloc[i][2])] = numberPerDay[str(df.iloc[i][2])] + 1
numberPerDay[str(df.iloc[i][1])] = numberPerDay[str(df.iloc[i][1])] + 1
endHour = endHour - 1
if i == (count-1):
currentDayList = str(df.iloc[i][2]).split(" ")
currentDayList = str(df.iloc[i][1]).split(" ")
currentDay = currentDayList[0]
tmp = []
for j in numberPerDay:
tmp.append(j)
for k in tmp:
if (k == str(df.iloc[i][2])):
if (k == str(df.iloc[i][1])):
numberPerDay[k] = numberPerDay.pop(str(k))
continue
if (len(str(k)) == 1):
Expand Down Expand Up @@ -127,4 +127,4 @@
yaxis = dict(title = 'Number of Events'),
)
fig = dict(data=data, layout=layout)
py.iplot(fig, filename='styled-line')
py.iplot(fig, filename='styled-line')

0 comments on commit a297055

Please sign in to comment.