title: Exporting or writing data from python pandas data frame to MS Access table
body: <p>I am trying to export data from a python pandas data frame to an existing MS Access table, I would like to replace the MS access table with data that has been updated (in python)
  I have tried to use pandas.to_sql, but I get an error message. I find this strange this using pandas.read_sql works seamlessly?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import pyodbc
  import pandas as pd
  conn_str = (
  r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};'
  r'DBQ=H:\Work\IndexTrader\Data\database\IndexData.accdb;'
  )
  cnxn = pyodbc.connect(conn_str)
  SQL = 'SELECT * FROM Index_data;
  </code></pre>
  
  <p>Reading data from MS Access is fine, see below</p>
  
  <pre><code>dfins = pd.read_sql(SQL, cnxn)
  </code></pre>
  
  <p>However when I try to write back and replace the table in MS excess it doesn't work?</p>
  
  <pre><code>dfins.to_sql('Index_data', cnxn, if_exists='replace')
  cnxn.close()
  </code></pre>
  
  <p>The error I get is:</p>
  
  <pre><code>DatabaseError: Execution failed on sql 'SELECT name FROM sqlite_master WHERE type='table' AND name=?;': ('42S02', "[42S02] [Microsoft][ODBC Microsoft Access Driver] The Microsoft Access database engine cannot find the input table or query 'sqlite_master'. Make sure it exists and that its name is spelled correctly. (-1305) (SQLExecDirectW)")
  </code></pre>
  
  <p>If there is an alternative way instead of pandas.to_sql, that would help as well, I just need to know how to export my data.</p>