From a325e7d4b2150e042c1f7e7551aafb7af7ff2c99 Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Fri, 29 Sep 2017 10:48:47 -0400 Subject: [PATCH 01/21] exercise6 file created --- .idea/vcs.xml | 6 ++++++ exercise6.py | 13 +++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 .idea/vcs.xml create mode 100644 exercise6.py diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/exercise6.py b/exercise6.py new file mode 100644 index 0000000..381b5b1 --- /dev/null +++ b/exercise6.py @@ -0,0 +1,13 @@ +#### EXERCISE 6 ##### + +#question 1 + + + + + + + + + +#question 2 \ No newline at end of file From d1dabf0f3eaaa8e4bd8aa87bf06264f2983d0837 Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Fri, 29 Sep 2017 10:56:21 -0400 Subject: [PATCH 02/21] data frame loaded! --- exercise6.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exercise6.py b/exercise6.py index 381b5b1..e11d441 100644 --- a/exercise6.py +++ b/exercise6.py @@ -3,7 +3,11 @@ #question 1 +#load the dataset +import pandas +bball = pandas.read_csv("UWvMSU_1-22-13.txt", sep='\t', lineterminator='\r') +print bball From 453ca367a567809d32636ff697c672c0d501e349 Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Fri, 29 Sep 2017 10:57:31 -0400 Subject: [PATCH 03/21] data frame loaded! --- exercise6.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/exercise6.py b/exercise6.py index e11d441..863e2e1 100644 --- a/exercise6.py +++ b/exercise6.py @@ -8,8 +8,7 @@ bball = pandas.read_csv("UWvMSU_1-22-13.txt", sep='\t', lineterminator='\r') print bball - - +#hello From 0afa63d3b7abed489d232c913002ccc44844f835 Mon Sep 17 00:00:00 2001 From: Katherine Date: Fri, 29 Sep 2017 11:02:16 -0400 Subject: [PATCH 04/21] Added blank matrix --- exercise6.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exercise6.py b/exercise6.py index 863e2e1..4b46840 100644 --- a/exercise6.py +++ b/exercise6.py @@ -5,8 +5,10 @@ #load the dataset import pandas +import numpy bball = pandas.read_csv("UWvMSU_1-22-13.txt", sep='\t', lineterminator='\r') - +A=numpy.zeros((50,3)) +B=pandas.DataFrame(A,columns=['Team','Time','CumeScore']) print bball #hello From 3007b62f7f909a15c36c69e3a725729b03b7f50e Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Fri, 29 Sep 2017 11:20:54 -0400 Subject: [PATCH 05/21] blank column --- exercise6.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/exercise6.py b/exercise6.py index 863e2e1..430e80a 100644 --- a/exercise6.py +++ b/exercise6.py @@ -7,8 +7,12 @@ import pandas bball = pandas.read_csv("UWvMSU_1-22-13.txt", sep='\t', lineterminator='\r') -print bball -#hello +#create blank column totalscore +bball2=bball.assign(totalscore="") +print bball2 + + + From c3935c72a605a46c2f0a5997a6182bf554274bff Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Fri, 29 Sep 2017 11:21:56 -0400 Subject: [PATCH 06/21] blank column --- exercise6.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercise6.py b/exercise6.py index 430e80a..ce3aeb4 100644 --- a/exercise6.py +++ b/exercise6.py @@ -11,7 +11,7 @@ bball2=bball.assign(totalscore="") print bball2 - +#hallo From db3a50eb03f5db0193839bfbc7f550e59cd5a8dd Mon Sep 17 00:00:00 2001 From: Katherine Date: Fri, 29 Sep 2017 15:55:07 -0400 Subject: [PATCH 07/21] Merging with master --- exercise6.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/exercise6.py b/exercise6.py index 4b46840..e9778db 100644 --- a/exercise6.py +++ b/exercise6.py @@ -9,9 +9,8 @@ bball = pandas.read_csv("UWvMSU_1-22-13.txt", sep='\t', lineterminator='\r') A=numpy.zeros((50,3)) B=pandas.DataFrame(A,columns=['Team','Time','CumeScore']) -print bball -#hello - +for Team in bball: + if Team= "MSU" From b1e5a9169f3d67c51bc0ab13e2e6562a40b80cc4 Mon Sep 17 00:00:00 2001 From: Katherine Date: Fri, 29 Sep 2017 16:15:56 -0400 Subject: [PATCH 08/21] Recreating blank dataframe --- exercise6.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/exercise6.py b/exercise6.py index 581b23e..5811c58 100644 --- a/exercise6.py +++ b/exercise6.py @@ -1,20 +1,17 @@ #### EXERCISE 6 ##### - #question 1 - #load the dataset import pandas bball = pandas.read_csv("UWvMSU_1-22-13.txt", sep='\t', lineterminator='\r') #create blank column totalscore bball2=bball.assign(totalscore="") -print bball2 - -#hallo - - - +print (bball2) +#Create blank dataframe +import numpy +A=numpy.zeros((50,3)) +B=pandas.DataFrame(A,columns=['Time','ScoreMSU','ScoreUW']) #question 2 From ace33dad19a53c684ff639669680de113f2c02d9 Mon Sep 17 00:00:00 2001 From: Katherine Date: Fri, 29 Sep 2017 17:24:00 -0400 Subject: [PATCH 09/21] Adding pseudocode to make cumulative sums --- exercise6.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/exercise6.py b/exercise6.py index 5811c58..8114d5b 100644 --- a/exercise6.py +++ b/exercise6.py @@ -13,5 +13,23 @@ import numpy A=numpy.zeros((50,3)) B=pandas.DataFrame(A,columns=['Time','ScoreMSU','ScoreUW']) +Time = bball.time + +#Steps remaining: +#print times in the Time column of B +#create a running cumulative score for each team in B +#pseudocode (doesn't work) +for team in bball: + if team == 'MSU': + ScoreMSU + bball.score + elif team == 'UW': + ScoreUW + bball.score + else: + print('Something is wrong') + +#actual plot +import matplotlib.pyplot as plt +plt.plot(Time,ScoreMSU,'g-',Time,ScoreUW,'gray-') #question 2 + From d53a8ebcc2351eff092a23a92c2e424883f6530c Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Sun, 1 Oct 2017 11:49:14 -0400 Subject: [PATCH 10/21] Merge branch 'master' of C:\Users\NicCage\PycharmProjects\exercise6\Intro_Biocom_ND_319_Tutorial6 with conflicts. --- exercise6.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/exercise6.py b/exercise6.py index 8114d5b..bd9c900 100644 --- a/exercise6.py +++ b/exercise6.py @@ -6,14 +6,20 @@ bball = pandas.read_csv("UWvMSU_1-22-13.txt", sep='\t', lineterminator='\r') #create blank column totalscore -bball2=bball.assign(totalscore="") -print (bball2) +bball2=bball.assign(totalscore=0) #Create blank dataframe import numpy A=numpy.zeros((50,3)) B=pandas.DataFrame(A,columns=['Time','ScoreMSU','ScoreUW']) Time = bball.time +print bball2.head(n=5) + +for i in range(0,len(bball2),1): + if bball2.team[i]=="UW": + print "science is fun" + else: + print "Dan smells" #Steps remaining: #print times in the Time column of B From 3b7852a09f6013119c3868de14d2df60c01618d3 Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Sun, 1 Oct 2017 11:57:42 -0400 Subject: [PATCH 11/21] q1: got a loop running through the dataframe --- exercise6.py | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/exercise6.py b/exercise6.py index bd9c900..352f26a 100644 --- a/exercise6.py +++ b/exercise6.py @@ -7,14 +7,9 @@ #create blank column totalscore bball2=bball.assign(totalscore=0) - -#Create blank dataframe -import numpy -A=numpy.zeros((50,3)) -B=pandas.DataFrame(A,columns=['Time','ScoreMSU','ScoreUW']) -Time = bball.time print bball2.head(n=5) + for i in range(0,len(bball2),1): if bball2.team[i]=="UW": print "science is fun" @@ -25,17 +20,16 @@ #print times in the Time column of B #create a running cumulative score for each team in B #pseudocode (doesn't work) -for team in bball: - if team == 'MSU': - ScoreMSU + bball.score - elif team == 'UW': - ScoreUW + bball.score - else: - print('Something is wrong') + +#Create blank dataframe +#import numpy +#A=numpy.zeros((50,3)) +#B=pandas.DataFrame(A,columns=['Time','ScoreMSU','ScoreUW']) +#Time = bball.time #actual plot -import matplotlib.pyplot as plt -plt.plot(Time,ScoreMSU,'g-',Time,ScoreUW,'gray-') +#import matplotlib.pyplot as plt +#plt.plot(Time,ScoreMSU,'g-',Time,ScoreUW,'gray-') #question 2 From 850bcd2d3dc68a2f027250615de1ef48a6acf840 Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Sun, 1 Oct 2017 13:26:06 -0400 Subject: [PATCH 12/21] q1: made lists --- exercise6.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/exercise6.py b/exercise6.py index 352f26a..0e8c992 100644 --- a/exercise6.py +++ b/exercise6.py @@ -3,18 +3,30 @@ #load the dataset import pandas +import numpy bball = pandas.read_csv("UWvMSU_1-22-13.txt", sep='\t', lineterminator='\r') #create blank column totalscore -bball2=bball.assign(totalscore=0) +bball2=bball.assign(totalscore="") print bball2.head(n=5) +#make blank lists +uw_list = [] +msu_list = [] for i in range(0,len(bball2),1): if bball2.team[i]=="UW": - print "science is fun" + uw_list.append(i) else: - print "Dan smells" + msu_list.append(i) +print uw_list +print msu_list + + + +#for x in uw list: +# forthe second value bball2.totalscore[i]= bball2.totalscore[i-1] + bball2.score[i] + #Steps remaining: #print times in the Time column of B From fbf6e605cc197d5bc24791243d85f15f59b53569 Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Sun, 1 Oct 2017 14:17:35 -0400 Subject: [PATCH 13/21] q1: work on list loop --- exercise6.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/exercise6.py b/exercise6.py index 0e8c992..3a6b397 100644 --- a/exercise6.py +++ b/exercise6.py @@ -8,7 +8,6 @@ #create blank column totalscore bball2=bball.assign(totalscore="") -print bball2.head(n=5) #make blank lists uw_list = [] @@ -22,6 +21,12 @@ print uw_list print msu_list +for i in range(0, len(uw_list), 1): + if i == 0: + print bball2.iloc[i] + else: + print bball2.iloc[i] + #for x in uw list: From 1fb609af6b1a82e6c50b653c177091b8da12b55a Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Sun, 1 Oct 2017 15:42:23 -0400 Subject: [PATCH 14/21] q1: got the count loop working!!!!!!!!!!!! now just need to graph. --- exercise6.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/exercise6.py b/exercise6.py index 3a6b397..a95f85b 100644 --- a/exercise6.py +++ b/exercise6.py @@ -13,6 +13,7 @@ uw_list = [] msu_list = [] +#fill lists - one for each team for i in range(0,len(bball2),1): if bball2.team[i]=="UW": uw_list.append(i) @@ -21,11 +22,25 @@ print uw_list print msu_list -for i in range(0, len(uw_list), 1): +#add total score columns UW +for i in range(len(uw_list)): + print(uw_list[i]) if i == 0: - print bball2.iloc[i] + bball2.loc[uw_list[i], "totalscore"] = bball2.score.loc[uw_list[i]] else: - print bball2.iloc[i] + bball2.loc[uw_list[i], "totalscore"] =bball2.totalscore.loc[uw_list[i-1]] + bball2.score.loc[uw_list[i]] + + +#add total score msu +for i in range(len(msu_list)): + print(msu_list[i]) + if i == 0: + bball2.loc[msu_list[i], "totalscore"] = bball2.score.loc[msu_list[i]] + else: + bball2.loc[msu_list[i], "totalscore"] =bball2.totalscore.loc[msu_list[i-1]] + bball2.score.loc[msu_list[i]] + +print bball2 + From 534b8a90cec61bc39066cea893dab380c68a50f1 Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Sun, 1 Oct 2017 15:44:59 -0400 Subject: [PATCH 15/21] q1: cleaned up code --- exercise6.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/exercise6.py b/exercise6.py index a95f85b..507f10b 100644 --- a/exercise6.py +++ b/exercise6.py @@ -19,12 +19,9 @@ uw_list.append(i) else: msu_list.append(i) -print uw_list -print msu_list #add total score columns UW for i in range(len(uw_list)): - print(uw_list[i]) if i == 0: bball2.loc[uw_list[i], "totalscore"] = bball2.score.loc[uw_list[i]] else: @@ -33,7 +30,6 @@ #add total score msu for i in range(len(msu_list)): - print(msu_list[i]) if i == 0: bball2.loc[msu_list[i], "totalscore"] = bball2.score.loc[msu_list[i]] else: @@ -42,23 +38,6 @@ print bball2 - - -#for x in uw list: -# forthe second value bball2.totalscore[i]= bball2.totalscore[i-1] + bball2.score[i] - - -#Steps remaining: -#print times in the Time column of B -#create a running cumulative score for each team in B -#pseudocode (doesn't work) - -#Create blank dataframe -#import numpy -#A=numpy.zeros((50,3)) -#B=pandas.DataFrame(A,columns=['Time','ScoreMSU','ScoreUW']) -#Time = bball.time - #actual plot #import matplotlib.pyplot as plt #plt.plot(Time,ScoreMSU,'g-',Time,ScoreUW,'gray-') From a66d22984c336c39f37afdcb4387f461c121cf3f Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Sun, 1 Oct 2017 15:47:04 -0400 Subject: [PATCH 16/21] q1: cleaned up code again- just needs to be graphed --- exercise6.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercise6.py b/exercise6.py index 507f10b..3f14543 100644 --- a/exercise6.py +++ b/exercise6.py @@ -37,7 +37,7 @@ print bball2 - +#jsut need to graph it! #actual plot #import matplotlib.pyplot as plt #plt.plot(Time,ScoreMSU,'g-',Time,ScoreUW,'gray-') From 5503e2d90a69ed7d064e8c8cdabe6a1a2d9f22aa Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Mon, 2 Oct 2017 12:17:36 -0400 Subject: [PATCH 17/21] q1: made a rough draft of the graph needs refining --- exercise6.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/exercise6.py b/exercise6.py index 3f14543..ce5faec 100644 --- a/exercise6.py +++ b/exercise6.py @@ -3,7 +3,6 @@ #load the dataset import pandas -import numpy bball = pandas.read_csv("UWvMSU_1-22-13.txt", sep='\t', lineterminator='\r') #create blank column totalscore @@ -37,9 +36,19 @@ print bball2 -#jsut need to graph it! -#actual plot +from plotnine import * +p=(ggplot(data=bball2) + + aes(x= "time", y= "totalscore", group= "team", color= "team") + + geom_line() + + geom_point() +) + +print p + + #import matplotlib.pyplot as plt + + #plt.plot(Time,ScoreMSU,'g-',Time,ScoreUW,'gray-') #question 2 From 3ea51ef7b128d90b8c267a9a0344d0aedb38beec Mon Sep 17 00:00:00 2001 From: Katherine Date: Tue, 3 Oct 2017 13:32:46 -0400 Subject: [PATCH 18/21] Cleaning up plot --- exercise6.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/exercise6.py b/exercise6.py index ce5faec..19e5911 100644 --- a/exercise6.py +++ b/exercise6.py @@ -28,28 +28,29 @@ #add total score msu + for i in range(len(msu_list)): if i == 0: bball2.loc[msu_list[i], "totalscore"] = bball2.score.loc[msu_list[i]] else: - bball2.loc[msu_list[i], "totalscore"] =bball2.totalscore.loc[msu_list[i-1]] + bball2.score.loc[msu_list[i]] + bball2.loc[msu_list[i], "totalscore"] =bball2.totalscore.loc[msu_list[i]] -print bball2 +print (bball2) +#making the plot! from plotnine import * p=(ggplot(data=bball2) - + aes(x= "time", y= "totalscore", group= "team", color= "team") + + aes(x= "time", y= "totalscore", group= 'team', color= 'team') + geom_line() + geom_point() + + xlab("Game Progress") + + ylab("Total Score") + + xlim(0,40) ) -print p - - -#import matplotlib.pyplot as plt - - -#plt.plot(Time,ScoreMSU,'g-',Time,ScoreUW,'gray-') - +import matplotlib.pyplot as plt +plt.plot(df['time'],df['totalscore'],gray-') +#print p +print (msu_list) #question 2 From e69df5e177dc0cc56d8857ca7934caebc695af27 Mon Sep 17 00:00:00 2001 From: Mati Nemera Date: Tue, 3 Oct 2017 22:05:19 -0400 Subject: [PATCH 19/21] question 2 --- exercise6.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/exercise6.py b/exercise6.py index 381b5b1..0e1c36e 100644 --- a/exercise6.py +++ b/exercise6.py @@ -10,4 +10,19 @@ -#question 2 \ No newline at end of file +#question 2 +import numpy +rand = numpy.random.randint(1, 101) +while True: + print("I'm thinking of a number 1-100...") + guess = input("Guess") + if guess < rand: + print("Higher") + continue + elif guess > rand: + print("Lower") + continue + elif guess == rand: + print("Correct!") + break + From 7f1f8f16b58b764939604a3bd3dcefd3c517b1c2 Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Wed, 4 Oct 2017 10:49:15 -0400 Subject: [PATCH 20/21] q1: fixed the broken loop... code was delted... q1 works now! --- exercise6.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/exercise6.py b/exercise6.py index f9b1103..0154d79 100644 --- a/exercise6.py +++ b/exercise6.py @@ -33,7 +33,7 @@ if i == 0: bball2.loc[msu_list[i], "totalscore"] = bball2.score.loc[msu_list[i]] else: - bball2.loc[msu_list[i], "totalscore"] =bball2.totalscore.loc[msu_list[i]] + bball2.loc[msu_list[i], "totalscore"] = bball2.totalscore.loc[msu_list[i - 1]] + bball2.score.loc[msu_list[i]] print (bball2) @@ -48,10 +48,9 @@ + xlim(0,40) ) -import matplotlib.pyplot as plt -plt.plot(df['time'],df['totalscore'],gray-') -#print p -print (msu_list) +#import matplotlib.pyplot as plt +#plt.plot(df['time'],df['totalscore'],gray-') +print p #question 2 import numpy From 3d47c31804104526ed83e0cda6c2970e39c7d6e3 Mon Sep 17 00:00:00 2001 From: omegadan01 Date: Wed, 4 Oct 2017 14:46:13 -0400 Subject: [PATCH 21/21] everything looks great and runs! I'm submitting! --- exercise6.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/exercise6.py b/exercise6.py index 0154d79..7852240 100644 --- a/exercise6.py +++ b/exercise6.py @@ -46,12 +46,12 @@ + xlab("Game Progress") + ylab("Total Score") + xlim(0,40) + +scale_color_manual(values=['green','red']) + + theme_classic() ) - -#import matplotlib.pyplot as plt -#plt.plot(df['time'],df['totalscore'],gray-') print p + #question 2 import numpy rand = numpy.random.randint(1, 101) #Generates a random number @@ -66,5 +66,4 @@ continue elif guess == rand: print("Correct!") - break - + break \ No newline at end of file