def _infer_types(self, values, na_values, try_num_bool=True):
na_count = <NUM_LIT:0><EOL>if issubclass(values.dtype.type, (np.number, np.bool_)):<EOL><INDENT>mask = algorithms.isin(values, list(na_values))<EOL>na_count = mask.sum()<EOL>if na_count > <NUM_LIT:0>:<EOL><INDENT>if is_integer_dtype(values):<EOL><INDENT>values = values.astype(np.float64)<EOL><DEDENT>np.putmask(values, mask, np.nan)<EOL><DEDENT>return values, na_count<EOL><DEDENT>if try_num_bool:<EOL><INDENT>try:<EOL><INDENT>result = lib.maybe_convert_numeric(values, na_values, False)<EOL>na_count = isna(result).sum()<EOL><DEDENT>except Exception:<EOL><INDENT>result = values<EOL>if values.dtype == np.object_:<EOL><INDENT>na_count = parsers.sanitize_objects(result,<EOL>na_values, False)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>result = values<EOL>if values.dtype == np.object_:<EOL><INDENT>na_count = parsers.sanitize_objects(values, na_values, False)<EOL><DEDENT><DEDENT>if result.dtype == np.object_ and try_num_bool:<EOL><INDENT>result = libops.maybe_convert_bool(np.asarray(values),<EOL>true_values=self.true_values,<EOL>false_values=self.false_values)<EOL><DEDENT>return result, na_count<EOL>
Infer types of values, possibly casting

Parameters
----------
values : ndarray
na_values : set
try_num_bool : bool, default try
   try to cast values to numeric (first preference) or boolean

Returns:
--------
converted : ndarray
na_count : int