I have a function that takes 2 inputs. I want it to read a csv file and return a one dimensional list that contains data from every row in a successive manner. I want my function to list every vote counts for every nominee in a list.
Code of my function is:
import csv
import pandas as pd
def retreiveData(filename,nominees):
file=open(filename)
csv_reader=csv.reader(file)
result=[]
return result
nominees=["Obama","Romney","Johnson","Stein","Others"]
retreiveData("ElectionUSA2012.csv",nominees)
There is some data in "ElectionUSA2012.csv".It contains vote counts for each nominee.