1. Sergey Astanin
  2. python-tabulate
  3. Issues
Issue #10 resolved

Support datetime, date and time in as cell values

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 "bug-datetime.py", line 5, in <module>
  File "/home/sergey/.local/lib/python2.7/site-packages/tabulate.py", line 423, in tabulate
    coltypes = list(map(_column_type, cols))
  File "/home/sergey/.local/lib/python2.7/site-packages/tabulate.py", line 262, in _column_type
    types = map(_type, strings)
  File "/home/sergey/.local/lib/python2.7/site-packages/tabulate.py", line 148, in _type
    elif _isnumber(string):
  File "/home/sergey/.local/lib/python2.7/site-packages/tabulate.py", line 129, in _isnumber
    return _isconvertible(float, string)
  File "/home/sergey/.local/lib/python2.7/site-packages/tabulate.py", 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