def _try_convert_data(self, name, data, use_dtypes=True,<EOL>convert_dates=True):
<EOL>if use_dtypes:<EOL><INDENT>if not self.dtype:<EOL><INDENT>return data, False<EOL><DEDENT>elif self.dtype is True:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>dtype = (self.dtype.get(name)<EOL>if isinstance(self.dtype, dict) else self.dtype)<EOL>if dtype is not None:<EOL><INDENT>try:<EOL><INDENT>dtype = np.dtype(dtype)<EOL>return data.astype(dtype), True<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>return data, False<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if convert_dates:<EOL><INDENT>new_data, result = self._try_convert_to_date(data)<EOL>if result:<EOL><INDENT>return new_data, True<EOL><DEDENT><DEDENT>result = False<EOL>if data.dtype == '<STR_LIT:object>':<EOL><INDENT>try:<EOL><INDENT>data = data.astype('<STR_LIT>')<EOL>result = True<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if data.dtype.kind == '<STR_LIT:f>':<EOL><INDENT>if data.dtype != '<STR_LIT>':<EOL><INDENT>try:<EOL><INDENT>data = data.astype('<STR_LIT>')<EOL>result = True<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>if len(data) and (data.dtype == '<STR_LIT:float>' or data.dtype == '<STR_LIT:object>'):<EOL><INDENT>try:<EOL><INDENT>new_data = data.astype('<STR_LIT>')<EOL>if (new_data == data).all():<EOL><INDENT>data = new_data<EOL>result = True<EOL><DEDENT><DEDENT>except (TypeError, ValueError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if data.dtype == '<STR_LIT:int>':<EOL><INDENT>try:<EOL><INDENT>data = data.astype('<STR_LIT>')<EOL>result = True<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return data, result<EOL>
Try to parse a ndarray like into a column by inferring dtype.