Repository navigation
Open
Labels
Description
Reproducing code example:
import numpy as np
dt = np.dtype([('b', np.datetime64)])
arr = np.zeros(1, dt)
repr(arr)Error message:
File "C:\Program Files\Python 3.5\lib\site-packages\IPython\core\formatters.py", line 693, in __call__
printer.pretty(obj)
File "C:\Program Files\Python 3.5\lib\site-packages\IPython\lib\pretty.py", line 380, in pretty
return _default_pprint(obj, self, cycle)
File "C:\Program Files\Python 3.5\lib\site-packages\IPython\lib\pretty.py", line 495, in _default_pprint
_repr_pprint(obj, p, cycle)
File "C:\Program Files\Python 3.5\lib\site-packages\IPython\lib\pretty.py", line 693, in _repr_pprint
output = repr(obj)
File "C:\Users\wiese\Repos\numeric-python\numpy\build\testenv\Lib\site-packages\numpy\core\arrayprint.py", line 1433, in array_repr
', ', prefix, suffix=suffix)
File "C:\Users\wiese\Repos\numeric-python\numpy\build\testenv\Lib\site-packages\numpy\core\arrayprint.py", line 670, in array2string
return _array2string(a, options, separator, prefix)
File "C:\Users\wiese\Repos\numeric-python\numpy\build\testenv\Lib\site-packages\numpy\core\arrayprint.py", line 460, in wrapper
return f(self, *args, **kwargs)
File "C:\Users\wiese\Repos\numeric-python\numpy\build\testenv\Lib\site-packages\numpy\core\arrayprint.py", line 486, in _array2string
format_function = _get_format_function(data, **options)
File "C:\Users\wiese\Repos\numeric-python\numpy\build\testenv\Lib\site-packages\numpy\core\arrayprint.py", line 433, in _get_format_function
return StructuredVoidFormat.from_data(data, **options)
File "C:\Users\wiese\Repos\numeric-python\numpy\build\testenv\Lib\site-packages\numpy\core\arrayprint.py", line 1270, in from_data
format_function = _get_format_function(data[field_name], **options)
File "C:\Users\wiese\Repos\numeric-python\numpy\build\testenv\Lib\site-packages\numpy\core\arrayprint.py", line 428, in _get_format_function
return formatdict['datetime']()
File "C:\Users\wiese\Repos\numeric-python\numpy\build\testenv\Lib\site-packages\numpy\core\arrayprint.py", line 365, in <lambda>
'datetime': lambda: DatetimeFormat(data, legacy=legacy),
File "C:\Users\wiese\Repos\numeric-python\numpy\build\testenv\Lib\site-packages\numpy\core\arrayprint.py", line 1222, in __init__
super(DatetimeFormat, self).__init__(x)
File "C:\Users\wiese\Repos\numeric-python\numpy\build\testenv\Lib\site-packages\numpy\core\arrayprint.py", line 1183, in __init__
max_str_len = max(len(self._format_non_nat(np.max(non_nat))),
File "C:\Users\wiese\Repos\numeric-python\numpy\build\testenv\Lib\site-packages\numpy\core\arrayprint.py", line 1233, in _format_non_nat
casting=self.casting)
ValueError: Cannot convert a NumPy datetime value other than NaT with generic units
Activity
eric-wieser commentedon Aug 16, 2018
1.13 gives
So probably not a 1.14 regression
tylerjereddy commentedon Aug 22, 2018
I've bisected to determine the first bad commit: 3d75c3f
I don't have a working patch just yet though as the diff on that commit is non-trivial, and the precise error did evolve over the commit history as you've noticed.
tylerjereddy commentedon Aug 22, 2018
@eric-wieser What do you expect the
reprto be for the case you provided? Before errors were raised it was[(None,)], which maybe isn't what you'd like to see.eric-wieser commentedon Aug 26, 2018
"structured arrays" are a red herring here - the same result is obtained from:
[-]BUG: repr of structured array containing generic datetime crashes[/-][+]BUG: repr of generic datetime crashes[/+]TST: expect printable generic datetime after numeric cast (numpygh-11752