def _harmonize_columns(self, parse_dates=None):
parse_dates = _process_parse_dates_argument(parse_dates)<EOL>for sql_col in self.table.columns:<EOL><INDENT>col_name = sql_col.name<EOL>try:<EOL><INDENT>df_col = self.frame[col_name]<EOL>if col_name in parse_dates:<EOL><INDENT>try:<EOL><INDENT>fmt = parse_dates[col_name]<EOL><DEDENT>except TypeError:<EOL><INDENT>fmt = None<EOL><DEDENT>self.frame[col_name] = _handle_date_column(<EOL>df_col, format=fmt)<EOL>continue<EOL><DEDENT>col_type = self._get_dtype(sql_col.type)<EOL>if (col_type is datetime or col_type is date or<EOL>col_type is DatetimeTZDtype):<EOL><INDENT>utc = col_type is DatetimeTZDtype<EOL>self.frame[col_name] = _handle_date_column(df_col, utc=utc)<EOL><DEDENT>elif col_type is float:<EOL><INDENT>self.frame[col_name] = df_col.astype(col_type, copy=False)<EOL><DEDENT>elif len(df_col) == df_col.count():<EOL><INDENT>if col_type is np.dtype('<STR_LIT>') or col_type is bool:<EOL><INDENT>self.frame[col_name] = df_col.astype(<EOL>col_type, copy=False)<EOL><DEDENT><DEDENT><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>
Make the DataFrame's column types align with the SQL table
column types.
Need to work around limited NA value support. Floats are always
fine, ints must always be floats if there are Null values.
Booleans are hard because converting bool column with None replaces
all Nones with false. Therefore only convert bool if there are no
NA values.
Datetimes should already be converted to np.datetime64 if supported,
but here we also force conversion if required.