#NEWLINE# def get_column_types( content ) : #NEWLINE# #INDENT# ' Figure out what type of content is in each column\n    of a csv-like input. This is a simple brute force method that\n    attempts to convert the strings of the content into floats and ints.\n    if the conversion is successful for all rows tested,\n    that type is considered the type of the column.\n    ' #NEWLINE# test_count = min ( len ( content ) , 5 ) #NEWLINE# col_count = len ( content [ 0 ] ) #NEWLINE# all_types = [ [ ] for i in range ( col_count ) ] #NEWLINE# for r_ind in range ( test_count ) : #NEWLINE# #INDENT# for ( col_ind , col ) in enumerate ( content [ r_ind ] ) : #NEWLINE# #INDENT# if isint ( col ) : #NEWLINE# #INDENT# all_types [ col_ind ] . append ( 'IntType' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isfloat ( col ) : #NEWLINE# #INDENT# all_types [ col_ind ] . append ( 'FloatType' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# all_types [ col_ind ] . append ( 'StringType' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# column_types = [ pick_type ( i ) for types in all_types ] #NEWLINE# return column_types