Support datetime, date and time in as cell values

Issue #10 resolved
Sergey Astanin
repo owner created an issue

Datetime, date, and time as cell values in tabulate-0.6 raise a TypeError. Convert them to strings and support properly.

Test case:

from __future__ import print_function
from tabulate import tabulate
from datetime import datetime



Traceback (most recent call last):
  File "", line 5, in <module>
  File "/home/sergey/.local/lib/python2.7/site-packages/", line 423, in tabulate
    coltypes = list(map(_column_type, cols))
  File "/home/sergey/.local/lib/python2.7/site-packages/", line 262, in _column_type
    types = map(_type, strings)
  File "/home/sergey/.local/lib/python2.7/site-packages/", line 148, in _type
    elif _isnumber(string):
  File "/home/sergey/.local/lib/python2.7/site-packages/", line 129, in _isnumber
    return _isconvertible(float, string)
  File "/home/sergey/.local/lib/python2.7/site-packages/", line 114, in _isconvertible
    n = conv(string)
TypeError: float() argument must be a string or a number

All Python versions affected.

Comments (1)

  1. Log in to comment