title: Insert date into a column in SQL from csv
body: <p>I have data in csv like this</p>
  
  <pre><code>RegisterDate    StoreID ProductID   ProductType Quantity
  30.12.2013      1002    00000576    001         10
  1.1.2014        1002    00008577    001        20
  2.1.2014        1002    00002917    002        12
  3.1.2014        1002    00007542    003         1
  4.1.2014        1002    00000964    002         1
  </code></pre>
  
  <p>I want to make a SQL table and I am using Python to populate the table. Following is my code:</p>
  
  <pre><code>import pymysql as MS
  import pandas as pd
  
  db = MS.connect(host="localhost",user="root",passwd="passwd",db="db")
  cursor = db.cursor()
  cursor.execute("create table IF NOT EXISTS sales (productID INT (25), registerDate DATE, storeID INT(5), productType INT (3), Quantity INT (100));")
  
  df = pd.read_csv('C:/Users/data.csv', encoding='latin-1')
  for i in range (len(df)):
      date = pd.to_datetime(df['RegisterDate'][i], format='%d.%m.%Y') # Converting the field value to datetime
      data = [int(df['ProductID'][i]), date, int(df['StoreID'][i]), int(df['ProductType'][i]), int(df['Quantity'][i]]
      cursor.execute('INSERT INTO sales(productID, registerDate, storeID, productType, Quantity )' 'VALUES("%s", "%s", "%s", "%s", "%s"  )', data)
  
  db.commit()
  cursor.close()
  </code></pre>
  
  <p>But I am getting the following error:</p>
  
  <pre><code>    Traceback (most recent call last):
    File "C:/Users/PycharmProjects/testproject/database.py", line 17, in &lt;module&gt;
      cursor.execute('INSERT INTO sales(productID, registerDate, storeID, productType, Quantity )' 'VALUES("%s", "%s", "%s", "%s", "%s"  )', data)
    File "C:\Python\Python35\lib\site-packages\pymysql\cursors.py", line 164, in execute
      query = self.mogrify(query, args)
    File "C:\Python\Python35\lib\site-packages\pymysql\cursors.py", line 143, in mogrify
      query = query % self._escape_args(args, conn)
    File "C:\Python\Python35\lib\site-packages\pymysql\cursors.py", line 118, in _escape_args
      return tuple(conn.literal(arg) for arg in args)
    File "C:\Python\Python35\lib\site-packages\pymysql\cursors.py", line 118, in &lt;genexpr&gt;
      return tuple(conn.literal(arg) for arg in args)
    File "C:\Python\Python35\lib\site-packages\pymysql\connections.py", line 821, in literal
      return self.escape(obj, self.encoders)
    File "C:\Python\Python35\lib\site-packages\pymysql\connections.py", line 814, in escape
      return escape_item(obj, self.charset, mapping=mapping)
    File "C:\Python\Python35\lib\site-packages\pymysql\converters.py", line 27, in escape_item
      val = encoder(val, mapping)
    File "C:\Python\Python35\lib\site-packages\pymysql\converters.py", line 110, in escape_unicode
      return u"'%s'" % _escape_unicode(value)
    File "C:\Python\Python35\lib\site-packages\pymysql\converters.py", line 73, in _escape_unicode
      return value.translate(_escape_table)
  AttributeError: 'Timestamp' object has no attribute 'translate'
  </code></pre>
  
  <p>I searched for the above error but does not a related answer. How can I fill in the dates with other columns ?</p>