Skip to content

Instantly share code, notes, and snippets.

@kendhia
Created December 17, 2016 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kendhia/2e2246739498b74d10dd8c58784c97ff to your computer and use it in GitHub Desktop.
Save kendhia/2e2246739498b74d10dd8c58784c97ff to your computer and use it in GitHub Desktop.
draft1
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