Created
December 17, 2016 17:57
-
-
Save kendhia/2e2246739498b74d10dd8c58784c97ff to your computer and use it in GitHub Desktop.
draft1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
csvReader = csv.reader(open("weather_2012.csv")) | |
weatherCsvList = list(csvReader) | |
weatherList = [] | |
weatherMeanDegree = [] | |
print(weatherCsvList[1][1]) | |
for i in range(1, len(weatherCsvList)): | |
if (weatherCsvList[i][7] in weatherList): | |
oldMeanDegree = weatherMeanDegree[weatherList.index(weatherCsvList[i][7])] | |
newMeanDegree = (oldMeanDegree + float(weatherCsvList[i][1]))/2 | |
else : | |
weatherList.append(weatherCsvList[i][7]) | |
weatherMeanDegree.append(float(weatherCsvList[i][1])) | |
for i in range(len(weatherList)): | |
print(weatherList[i], " ", format(weatherMeanDegree[i], "2.7f")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment