1#Convert the list into CSV file
2mycsv = csv.writer(open(r'C:\Users\ashen\OneDrive\Desktop\ITSS 4355.001 - Data Visualization - F20\Ashenafe.csv','w', newline=''))
3for row in list1:
4#Fetching the row index
5#No calculation is done at header level
6 e= list1.index(row)
7#Compare the year value of the current record with the year value of the previous record
8#if same calculate the rank, if different assign the rank as one
9 if row[1] != c and e != 0:
10 v=1
11 C= row[1]
12 row[3]= v
13 else:
14 if row[1] == c and e != 0:
15 v+=1
16 row[3]= v
17#write row to csv
18 mycsv.writerow(row)
19