def _resolved_type(self):
import datetime<EOL>self.type_ratios = {test: (float(self.type_counts[test]) / float(self.count)) if self.count else None<EOL>for test, testf in tests + [(None, None)]}<EOL>try:<EOL><INDENT>if self.type_ratios.get(text_type,<NUM_LIT:0>) + self.type_ratios.get(binary_type,<NUM_LIT:0>) > <NUM_LIT>:<EOL><INDENT>if self.type_counts[text_type] > <NUM_LIT:0>:<EOL><INDENT>return text_type, False<EOL><DEDENT>elif self.type_counts[binary_type] > <NUM_LIT:0>:<EOL><INDENT>return binary_type, False<EOL><DEDENT><DEDENT><DEDENT>except TypeError as e:<EOL><INDENT>pass<EOL><DEDENT>if self.type_counts[datetime.datetime] > <NUM_LIT:0>:<EOL><INDENT>num_type = datetime.datetime<EOL><DEDENT>elif self.type_counts[datetime.date] > <NUM_LIT:0>:<EOL><INDENT>num_type = datetime.date<EOL><DEDENT>elif self.type_counts[datetime.time] > <NUM_LIT:0>:<EOL><INDENT>num_type = datetime.time<EOL><DEDENT>elif self.type_counts[float] > <NUM_LIT:0>:<EOL><INDENT>num_type = float<EOL><DEDENT>elif self.type_counts[int] > <NUM_LIT:0>:<EOL><INDENT>num_type = int<EOL><DEDENT>elif self.type_counts[text_type] > <NUM_LIT:0>:<EOL><INDENT>num_type = text_type<EOL><DEDENT>elif self.type_counts[binary_type] > <NUM_LIT:0>:<EOL><INDENT>num_type = binary_type<EOL><DEDENT>else:<EOL><INDENT>num_type = unknown<EOL><DEDENT>if self.type_counts[binary_type] > <NUM_LIT:0> and num_type != binary_type:<EOL><INDENT>has_codes = True<EOL><DEDENT>else:<EOL><INDENT>has_codes = False<EOL><DEDENT>return num_type, has_codes<EOL>
Return the type for the columns, and a flag to indicate that the
        column has codes.