def fix_str(value):
    try:
        return unicode(value)
    except UnicodeDecodeError:
        return unicode(value.decode('latin1'))


def pandas_to_dict(df):
    return [{colname: (fix_str(row[i]) if type(row[i]) is str else row[i])
             for i, colname in enumerate(df.columns)}
            for row in df.values]

from pandas import tslib
def fix_render(value):
    if type(value) is str:
        try:
            return unicode(value)
        except UnicodeDecodeError:
            return unicode(value.decode('latin1'))
    elif type(value) is tslib.Timestamp:
        return value.strftime("%Y-%m-%d %H:%M:%S")
    return value


def pandas_to_dict(df):
    return [{colname: fix_render(row[i])
             for i, colname in enumerate(df.columns)}
            for row in df.values]

Fix date format on fix render
Fix date format on fix render

+ from pandas import tslib
- def fix_str(value):
+ def fix_render(value):
+     if type(value) is str:
-     try:
+         try:
-         return unicode(value)
+             return unicode(value)
-     except UnicodeDecodeError:
+         except UnicodeDecodeError:
-         return unicode(value.decode('latin1'))
+             return unicode(value.decode('latin1'))
+     elif type(value) is tslib.Timestamp:
+         return value.strftime("%Y-%m-%d %H:%M:%S")
+     return value
  
  
  def pandas_to_dict(df):
-     return [{colname: (fix_str(row[i]) if type(row[i]) is str else row[i])
+     return [{colname: fix_render(row[i])
               for i, colname in enumerate(df.columns)}
              for row in df.values]
  
Fix date format on fix render
## Code Before:
def fix_str(value):
    try:
        return unicode(value)
    except UnicodeDecodeError:
        return unicode(value.decode('latin1'))


def pandas_to_dict(df):
    return [{colname: (fix_str(row[i]) if type(row[i]) is str else row[i])
             for i, colname in enumerate(df.columns)}
            for row in df.values]

## Instruction:
Fix date format on fix render
## Code After:
from pandas import tslib
def fix_render(value):
    if type(value) is str:
        try:
            return unicode(value)
        except UnicodeDecodeError:
            return unicode(value.decode('latin1'))
    elif type(value) is tslib.Timestamp:
        return value.strftime("%Y-%m-%d %H:%M:%S")
    return value


def pandas_to_dict(df):
    return [{colname: fix_render(row[i])
             for i, colname in enumerate(df.columns)}
            for row in df.values]
