title: Got error 'sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.' when insert data into table using sqlite3 python
body: <p>I tried to get the data from a url link and store it in a db file. When I converted the retrieved data to dataframe and inserted it into the table, I got an Error message saying 'sqlite3.InterfaceError: Error binding parameter 1-probably unsupported type.'</p>
  
  <p><strong>Here is my code:</strong></p>
  
  <pre><code>import pandas as pd
  import requests
  import sqlite3
  from pandas.io import sql
  database_file = 'z5192421.db'
  
  def if_table_exist(cnx,table_name):
      c = cnx.cursor()
      c.execute(f"SELECT name FROM sqlite_master WHERE type = 'table' AND 
          name='{table_name}'")
      return c.fetchone()
  
  
  def write_in_sqlite(dataframe, database_file, table_name):
      cnx = sqlite3.connect(database_file)
      c = cnx.cursor()
  
      if not if_table_exist(cnx, table_name):
          sql.to_sql(dataframe, name=table_name, con=cnx)
      else:
          for index, row in dataframe.iterrows():
              values = '('+','.join(['?']*len(dataframe.columns))+')'
              c.execute(f'INSERT INTO {table_name} VALUES {values}',
                        tuple(row.values))
  
  
  
  def post():
      url = 'http://api.worldbank.org/v2/countries/all/indicators/' \
            'NY.GDP.MKTP.CD?date=2012:2017&amp;format=json&amp;per_page=1000'
      data = requests.get(url).json()[1]
      dfItem = pd.DataFrame.from_records(data)
      write_in_sqlite(dfItem,database_file, 'DATA')
  
  post()
  </code></pre>
  
  <p><strong>And the traceback:</strong></p>
  
  <pre><code>Traceback (most recent call last):
    File "/Users/chenhao/PycharmProjects/untitled/9321/post_to_stack.py", **line 34, in &lt;module&gt;
      post()**
  
    File "/Users/chenhao/PycharmProjects/untitled/9321/post_to_stack.py", **line 32, in post
      write_in_sqlite(dfItem,database_file, 'DATA')**
  
    File "/Users/chenhao/PycharmProjects/untitled/9321/post_to_stack.py", **line 19, in write_in_sqlite
      sql.to_sql(dataframe, name=table_name, con=cnx,index = False)**
  
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/io/sql.py", **line 512, in to_sql
      pandas_sql.to_sql(**
  
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/io/sql.py", **line 1734, in to_sql
      table.insert(chunksize, method)**
  
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/io/sql.py", **line 755, in insert
      exec_insert(conn, keys, chunk_iter)**
  
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas/io/sql.py", **line 1464, in _execute_insert
      conn.executemany(self.insert_statement(), data_list)**
  sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.
  </code></pre>