#NEWLINE# def parse_csv( csv_reader ) : #NEWLINE# #INDENT# previous_date = None #NEWLINE# data = [ ] #NEWLINE# dtype = [ ( 'dt' , 'int64' ) , ( 'sid' , '|S14' ) , ( 'open' , float ) , ( 'high' , float ) , ( 'low' , float ) , ( 'close' , float ) , ( 'volume' , int ) ] #NEWLINE# for line in csv_reader : #NEWLINE# #INDENT# row = process_line ( line ) #NEWLINE# current_date = line [ 'dt' ] [ : 10 ] . replace ( '-' , '' ) #NEWLINE# if ( previous_date and ( previous_date != current_date ) ) : #NEWLINE# #INDENT# rows = np . array ( data , dtype = dtype ) . view ( np . recarray ) #NEWLINE# ( yield ( current_date , rows ) ) #NEWLINE# data = [ ] #NEWLINE# #UNINDENT# data . append ( row ) #NEWLINE# previous_date = current_date