8000 Inconsistent and incorrect datetime64 string representations when in structured array · Issue #5692 · numpy/numpy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Inconsistent and incorrect datetime64 string representations when in structured array #5692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gerritholl opened this issue Mar 18, 2015 · 0 8000 comments

Comments

@gerritholl
Copy link
Contributor

datetime64 string representations are inconsistent when in structured arrays. When the value should be NaT, they are shows as None inside a structured array. The showing of timezones is also inconsistent, as the code snippet below shows.

In [196]: A = numpy.zeros(shape=10, dtype=[("A", "M8[s]")])

In [197]: A[5:].fill(numpy.nan)

In [198]: A
Out[198]: 
array([(datetime.datetime(1970, 1, 1, 0, 0),),
       (datetime.datetime(1970, 1, 1, 0, 0),),
       (datetime.datetime(1970, 1, 1, 0, 0),),
       (datetime.datetime(1970, 1, 1, 0, 0),),
       (datetime.datetime(1970, 1, 1, 0, 0),), (None,), (None,), (None,),
       (None,), (None,)], 
      dtype=[('A', '<M8[s]')])

In [199]: A["A"]
Out[199]: 
array(['1969-12-31T19:00:00-0500', '1969-12-31T19:00:00-0500',
       '1969-12-31T19:00:00-0500', '1969-12-31T19:00:00-0500',
       '1969-12-31T19:00:00-0500', 'NaT', 'NaT', 'NaT', 'NaT', 'NaT'], dtype='datetime64[s]')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0