Skip to content

Instantly share code, notes, and snippets.

@kendhia
Created December 17, 2016 18:24
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/6079768ec295216f435d13ca759ecaa7 to your computer and use it in GitHub Desktop.
Save kendhia/6079768ec295216f435d13ca759ecaa7 to your computer and use it in GitHub Desktop.
draft2
import csv
csvReader = csv.reader(open("weather_2012.csv"))
weatherCsvList = list(csvReader)
weatherDic = {}
weatherMeanDegree = []
for i in range(1, len(weatherCsvList)):
if weatherDic.__contains__(weatherCsvList[i][7] in weatherDic):
weatherDic[weatherCsvList[i][7]] = (weatherDic[weatherCsvList[i][7]] + float(weatherCsvList[i][1]))/2
else :
weatherDic[weatherCsvList[i][7]] = float(weatherCsvList[i][1])
#Sorting the dict
for key in sorted(weatherDic):
print(key, " ", weatherDic[key])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment