From f5e90c7c1c5e940527648cbe1f1ec88fb30d9d08 Mon Sep 17 00:00:00 2001 From: Chirag Jangir <184008125+chiragjangiir@users.noreply.github.com> Date: Sun, 18 Oct 2026 08:46:57 +0530 Subject: [PATCH] fix: preserve NumPy datetime formatting (issue #251) Exclude NumPy datetime and timedelta values from numeric detection so nanosecond timestamps and zero-dimensional temporal arrays are rendered as text rather than scientific-notation floats. Add regression coverage for scalar and array inputs, multiple datetime resolutions, and mixed numeric tables. Fixes #251. --- tabulate/__init__.py | 6 +++++ test/test_regression.py | 59 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/tabulate/__init__.py b/tabulate/__init__.py index 12a2950..d87a673 100644 --- a/tabulate/__init__.py +++ b/tabulate/__init__.py @@ -911,6 +911,12 @@ def _isnumber(string): # convertible to int/float. or ( _isconvertible(float, string) + and not ( + str(type(string)).startswith( + ("