You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the 2.0.0 development version of numpy on ububtu 10.10 .
When string arguments for the dtype are given for a record array, and one of the individual dtypes is datetime64[D], the day part is lost and the datetime become generic. This makes it impossible to assign anything to it.
For example, look at
np.zeros(4, dtype = ','.join(['datetime64[D]', 'i4']))
This gives an array with dtype dtype=[('f0', <M8), ('f1', '<i4')], where the <M8 should be <M8[D].
A different bug happens when putting datetimes into masked arrays. For example,
np.ma.zeros(4,dtype= 'datetime64[D],i4')
gives a ValueError: mismatch in size of old and new data-descriptor with traceback
/home/intern/my26/lib/python2.6/site-packages/numpy/ma/core.pyc in call(self, a, _args, *_params)
7142 _extras[p] = params.pop(p)
7143 # Get the result
-> 7144 result = self._func.call(a, _args, *_params).view(MaskedArray)
7145 if "fill_value" in common_params:
7146 result.fill_value = _extras.get("fill_value", None)
/home/intern/my26/lib/python2.6/site-packages/numpy/ma/core.pyc in array_finalize(self, obj)
2794 if self.dtype.names:
2795 if self._fill_value is None:
-> 2796 self._fill_value = _check_fill_value(None, self.dtype)
2797 return
2798
/home/intern/my26/lib/python2.6/site-packages/numpy/ma/core.pyc in _check_fill_value(fill_value, ndtype)
392 if fields:
393 descr = ndtype.descr
--> 394 fill_value = np.array(_recursive_set_default_fill_value(descr),
395 dtype=ndtype,)
396 else:
Original ticket http://projects.scipy.org/numpy/ticket/1912 on 2011-07-18 by @chrisjordansquire, assigned to unknown.
I'm using the 2.0.0 development version of numpy on ububtu 10.10 .
When string arguments for the dtype are given for a record array, and one of the individual dtypes is datetime64[D], the day part is lost and the datetime become generic. This makes it impossible to assign anything to it.
For example, look at
np.zeros(4, dtype = ','.join(['datetime64[D]', 'i4']))
This gives an array with dtype dtype=[('f0', <M8), ('f1', '<i4')], where the <M8 should be <M8[D].
A different bug happens when putting datetimes into masked arrays. For example,
np.ma.zeros(4,dtype= 'datetime64[D],i4')
gives a ValueError: mismatch in size of old and new data-descriptor with traceback
/home/intern/my26/lib/python2.6/site-packages/numpy/ma/core.pyc in call(self, a, _args, *_params)
7142 _extras[p] = params.pop(p)
7143 # Get the result
-> 7144 result = self._func.call(a, _args, *_params).view(MaskedArray)
7145 if "fill_value" in common_params:
7146 result.fill_value = _extras.get("fill_value", None)
/home/intern/my26/lib/python2.6/site-packages/numpy/ma/core.pyc in array_finalize(self, obj)
2794 if self.dtype.names:
2795 if self._fill_value is None:
-> 2796 self._fill_value = _check_fill_value(None, self.dtype)
2797 return
2798
/home/intern/my26/lib/python2.6/site-packages/numpy/ma/core.pyc in _check_fill_value(fill_value, ndtype)
392 if fields:
393 descr = ndtype.descr
--> 394 fill_value = np.array(_recursive_set_default_fill_value(descr),
395 dtype=ndtype,)
396 else:
/home/intern/my26/lib/python2.6/site-packages/numpy/ma/core.pyc in _recursive_set_default_fill_value(dtypedescr)
360 deflist.append(tuple(_recursive_set_default_fill_value(currenttype)))
361 else:
--> 362 deflist.append(default_fill_value(np.dtype(currenttype)))
363 return tuple(deflist)
364
ValueError: mismatch in size of old and new data-descriptor
The text was updated successfully, but these errors were encountered: