summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wiebe <mwwiebe@gmail.com>2011-08-16 20:03:22 -0700
committerCharles Harris <charlesr.harris@gmail.com>2011-08-27 07:26:55 -0600
commit965e4cff5c4c50e8ff051a3363adc6cf6aa640cd (patch)
treee9b8d484dac4446ef0a3abd24d94e88922093b05
parentb1cb211d159c617ee4ebd16266d6f1042417ef75 (diff)
downloadnumpy-965e4cff5c4c50e8ff051a3363adc6cf6aa640cd.tar.gz
ENH: missingdata: trying some more functions to see how they treat NAs
-rw-r--r--doc/neps/missing-data.rst4
-rw-r--r--doc/release/2.0.0-notes.rst12
-rw-r--r--numpy/lib/function_base.py4
3 files changed, 15 insertions, 5 deletions
diff --git a/doc/neps/missing-data.rst b/doc/neps/missing-data.rst
index 478fe81bc..49528da41 100644
--- a/doc/neps/missing-data.rst
+++ b/doc/neps/missing-data.rst
@@ -477,7 +477,7 @@ Some examples::
>>> np.sum(a, skipna=True)
11.0
>>> np.mean(a)
- NA('<f8')
+ NA(dtype='<f8')
>>> np.mean(a, skipna=True)
3.6666666666666665
@@ -487,7 +487,7 @@ Some examples::
>>> np.max(a, skipna=True)
array(NA, dtype='<f8', maskna=True)
>>> np.mean(a)
- NA('<f8')
+ NA(dtype='<f8')
>>> np.mean(a, skipna=True)
/home/mwiebe/virtualenvs/dev/lib/python2.7/site-packages/numpy/core/fromnumeric.py:2374: RuntimeWarning: invalid value encountered in double_scalars
return mean(axis, dtype, out)
diff --git a/doc/release/2.0.0-notes.rst b/doc/release/2.0.0-notes.rst
index 0ba7594fe..d50797cb3 100644
--- a/doc/release/2.0.0-notes.rst
+++ b/doc/release/2.0.0-notes.rst
@@ -26,9 +26,10 @@ What works with NA:
* Basic indexing and slicing, as well as full boolean mask indexing.
* All element-wise ufuncs.
* UFunc.reduce methods, with a new skipna parameter.
+ * The nditer object.
* Array methods:
+ ndarray.clip, ndarray.min, ndarray.max, ndarray.sum, ndarray.prod,
- ndarray.conjugate, ndarray.diagonal
+ ndarray.conjugate, ndarray.diagonal, ndarray.flatten
+ numpy.concatenate, numpy.column_stack, numpy.hstack,
numpy.vstack, numpy.dstack
@@ -36,6 +37,8 @@ What doesn't work with NA:
* Fancy indexing, such as with lists and partial boolean masks.
* ndarray.flat and any other methods that use the old iterator
mechanism instead of the newer nditer.
+ * Struct dtypes, which will have corresponding struct masks with
+ one mask value per primitive field of the struct dtype.
* UFunc.reduce of multi-dimensional arrays, with skipna=True and a ufunc
that doesn't have an identity.
* UFunc.accumulate, UFunc.reduceat.
@@ -43,7 +46,10 @@ What doesn't work with NA:
rules NA | True == True and NA & False == False yet.
* Array methods:
+ ndarray.argmax, ndarray.argmin,
- + numpy.repeat
+ + numpy.repeat, numpy.delete (relies on fancy indexing),
+ numpy.append, numpy.insert (relies on fancy indexing),
+ numpy.where,
+
Custom formatter for printing arrays
@@ -66,7 +72,7 @@ where possible, and performs much faster as well.
The function np.concatenate tries to match the layout of its input
arrays. Previously, the layout did not follow any particular reason,
-and depended in an undesirable on the particular axis chosen for
+and depended in an undesirable way on the particular axis chosen for
concatenation. A bug was also fixed which silently allowed out of bounds
axis arguments.
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index caef5c709..411a86955 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -3317,6 +3317,7 @@ def delete(arr, obj, axis=None):
"invalid entry")
newshape[axis]-=1;
new = empty(newshape, arr.dtype, arr.flags.fnc)
+ new.flags.maskna = arr.flags.maskna
slobj[axis] = slice(None, obj)
new[slobj] = arr[slobj]
slobj[axis] = slice(obj,None)
@@ -3333,6 +3334,7 @@ def delete(arr, obj, axis=None):
return arr.copy()
newshape[axis] -= numtodel
new = empty(newshape, arr.dtype, arr.flags.fnc)
+ new.flags.maskna = arr.flags.maskna
# copy initial chunk
if start == 0:
pass
@@ -3464,6 +3466,7 @@ def insert(arr, obj, values, axis=None):
"in dimension %d" % (obj, N, axis))
newshape[axis] += 1;
new = empty(newshape, arr.dtype, arr.flags.fnc)
+ new.flags.maskna = arr.flags.maskna
slobj[axis] = slice(None, obj)
new[slobj] = arr[slobj]
slobj[axis] = obj
@@ -3490,6 +3493,7 @@ def insert(arr, obj, values, axis=None):
index2 = setdiff1d(arange(numnew+N),index1)
newshape[axis] += numnew
new = empty(newshape, arr.dtype, arr.flags.fnc)
+ new.flags.maskna = arr.flags.maskna
slobj2 = [slice(None)]*ndim
slobj[axis] = index1
slobj2[axis] = index2