def writeEntropy2(staffeln, filename): f = open(filename + ".csv", "w") start = "Episode,MULDER,SCULLY\n" #m = mulder() #s = scully() episodenzahlen = [23, 25, 24, 24, 20, 22] z = 0 while z < 6: if z in staffeln: for i in range(0, episodenzahlen[z]): print(episodenzahlen[z]) m = open("toLower_mulder" + str(z + 1), "r") s = open("toLower_scully" + str(z + 1), "r") mulder = m.read() mulderEpisodes = mulder.split("separator") print(str(len(mulderEpisodes))) scully = s.read() scullyEpisodes = scully.split("separator") print(str(len(scullyEpisodes))) if ((averageEntropy(mulderEpisodes[i]) != 0) and (averageEntropy(scullyEpisodes[i]) != 0)): start += "S" + str(z + 1) + "E" + str(i + 1) + "," + str( averageEntropy(mulderEpisodes[i])) + "," + str( averageEntropy(scullyEpisodes[i])) + "\n" else: pass m.close s.close z += 1 f.write(start) f.flush f.close
def writeEntropy(): f = open("valuesEntropy.csv", "w") start = "Episode,MULDER,SCULLY\n" m = mulder() s = scully() for i in range(1, 24): start += str(i)+","+str(averageEntropy(m[i-1]))+","+str(averageEntropy(s[i-1]))+"\n" f.write(start) f.flush f.close