title: Pandas read_sql DataTypes
body: <p>I have to compare two data sources to see if the same record is the same across all rows. One data source comes from an Excel File, where another comes from a SQL Table. I tried using <a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.equals.html" rel="nofollow noreferrer"><code>DataFrame.equals()</code></a> Like i have in the past. </p>
  
  <p>However, the issue is due to pesky datatype issues. Even though the data <em>looks</em> the same, the datatypes are making <code>excel_df.loc[excel_df['ID'] = 1].equals(sql_df.loc[sql_df['ID'] = 1])</code> return <code>False</code>. Here is an example of the datatype from <code>pd.read_excel()</code>:</p>
  
  <pre><code>COLUMN ID                         int64
  ANOTHER Id                      float64
  SOME Date                datetime64[ns]
  Another Date             datetime64[ns] 
  </code></pre>
  
  <p>The same columns from <code>pd.read_sql</code>:</p>
  
  <pre><code>COLUMN ID                        float64
  ANOTHER Id                       float64
  SOME Date                         object
  Another Date                      object
  </code></pre>
  
  <p>I could try using the <code>converters</code> argument from <a href="http://pandas.pydata.org/pandas-docs/version/0.20/generated/pandas.read_excel.html" rel="nofollow noreferrer"><code>pd.read_excel()</code></a> to match SQL. Or also doing <code>df['Column_Name] = df['Column_Name].astype(dtype_here)</code> But I am dealing with a lot of columns. Is there an easier way to check for values across all columns?</p>
  
  <p>checking <a href="http://pandas.pydata.org/pandas-docs/version/0.20/generated/pandas.read_sql.html" rel="nofollow noreferrer"><code>pd.read_sql()</code></a> there is no thing like <code>converters</code> but I'm looking for something like: </p>
  
  <pre><code>df = pd.read_sql("Select * From Foo", con, dtypes = ({Column_name: str,
                                                        Column_name2:int}))
  </code></pre>