Question: Write a function, reformatDate ( ifile ) which uses the readCSV( ifile ) to prepare the input file of Supplies.csv for this problem. Using the
Write a function, reformatDate(ifile) which uses the readCSV(ifile) to prepare the input file of Supplies.csvfor this problem. Using the list returned from readCSV(ifile), change the date column to be of the form: month day, year
This is readCSV(ifile)
def readCSV(ifile): mlist=[] infile=open(ifile,'r') lines=infile.readlines() for line in lines: slist=[] line=line.replace(' ','') entries=line.split(',') for i in range(len(entries)): slist.append(entries[i]) mlist.append(slist) return mlist
This is the output of readCSV(ifile) in python

This is the output of this python function reformatDate(ifile) in Python please

>>>readCSV(Supplies.csv) LC'OrderDate', 'Region', "Rep' 'Item', 'Units', Unit Price'], C'4-Jul-14', 'Ea st', 'Richard', Pencil1', '7', '1.29'], C'12-Jul-14, East', 'Nick', 'Pencil 2', '14', '1.29'], C'21-Jul-14', "Central', 'Morgan', 'Pencil 3', '67', '1.29'], C'29-Jul-14', 'East', 'Susan'Pencil 4', '53', '1.29'], C'7-Aug-14', "Central 'Matthew', 'Binder A', "29', '1.99'], ['15-Aug-14', 'East', "Richard', 'Pen 1 ', "76', 1.99'], C'10-Sep-14', "Central', 'Bill', 'Pencil 5', 95', '1.99'], [' 18-Sep-14''East''Richard' 'Pencil 6'.66"'1.99', '27-Sep-14' 'West James', 'Pencil 7', '75', '1.99'], C'5-0ct-14', "North', 'Morgan', Pencil 8', 32", '1.99'], C'14-0ct-14', 'West', 'Thomas', Pencil 9', '56', '2.99'], C'22-0 ct-14 East', 'Richard', "Binder B', '11', "4.99'1, C'31-0ct-14', "Central', ' Rachel'.'Binder C''28' 4.99'1, '8-Nov-14 'East" 'Susan 'Binder D' "4 "4.99'], C'17-Nov-14', "Central', "Alex, 'Binder E, "60, "4.99'], C'25-Nov 14, 'North', 'Matt', 'Pen 2", '96', 4.99'], C'4-Dec-14', "Central' 'Alex', ' Pen Set A, '62', "4.99'], ['12-Dec-14', "Central', 'Smith', 'Pen Set B', '96', 4.99'1, ['21-Dec-14' 'South, Rachel 'Pen Set C', '50', 4.99'], C'29-Dec-1 4 East', Susan' 'Pencil 10, 35', "4.99'], C'6-Jan-15, "East', "Richard', Pencil 11', "36', "4.99'], C'15-Jan-15', "Central', "Bill, Pencil 12', 90', 4.99'1, C'23-Jan-15', 'Central', 'Matthew', 'Pencil 13', "90', "4.99'], C'1-Fe b-15', "Central', "Smith', 'Binder F', '28', 8.99'1, C'9-Feb-15', 'Central', 'A lex', 'Binder G', "46, '8.99'], C'18-Feb-15', 'East', Richard', 'Binder H', '8 0', "8.99'], C' 26-Feb-15', "Central', "Bill', 'Binder I', '60', "8.99'], C'7-Mar 15', West', James', 'Pen 3', 64', '8.99'1, C'15-Mar-15', 'West', James', 'P en Set D', "55', '12.49'], C'24-Mar-15 "Central', "Alex 'Binder J', '87', 1 5'], C'1-Apr-15 "East', 'Matt', 'Pen Set E, '16', '15.99'], C'10-Apr-15', "Ce ntral', Rachel', 'Pen Set F', '74', '15.99'], C'18-Apr-15', 'South', 'Rachel', Binder K', "81', 19.99'], C'27-Apr-15', East', 'Nick', "Binder L', '57', '19. 99'], C'5-May-15', "Central', Alex' 'Binder M, '94", '19.99'], C'14-May-15', "Central', "Bill', "Binder N', '50, '19.99'], C'22-May-15', 'West' 'Thomas', ' Binder 0', '7', 19.99'], C'31-May-15', "Central', 'Bill', 'Pen 4', '15', '19.99 '], C'8-Jun-15', 'East', "Richard', 'Pen 5', 27', '19.99'], C'25-Jun-15', Cent ral', 'Matt', 'Pen Set G', '42", "23.95']]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
