#NEWLINE# def sample_data( path , dialect , sample_size , **kwargs ) : #NEWLINE# #INDENT# book = xlrd . open_workbook ( path , on_demand = True ) #NEWLINE# sheet = book . sheet_by_index ( 0 ) #NEWLINE# samples = [ ] #NEWLINE# for i in range ( 1 , min ( sheet . nrows , ( sample_size + 1 ) ) ) : #NEWLINE# #INDENT# values = sheet . row_values ( i ) #NEWLINE# types = sheet . row_types ( i ) #NEWLINE# normal_values = [ ] #NEWLINE# for ( v , t ) in zip ( values , types ) : #NEWLINE# #INDENT# if ( t == xlrd . biffh . XL_CELL_DATE ) : #NEWLINE# #INDENT# v = normalize_date ( v , book . datemode ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( t == xlrd . biffh . XL_CELL_NUMBER ) : #NEWLINE# #INDENT# if ( ( v % 1 ) == 0 ) : #NEWLINE# #INDENT# v = int ( v ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# normal_values . append ( unicode ( t ) ) #NEWLINE# #UNINDENT# samples . append ( normal_values ) #NEWLINE# #UNINDENT# return samples