On Sun, Apr 25, 2010 at 16:17, Robert Kern <robert.k...@gmail.com> wrote:
> On Thu, Apr 22, 2010 at 16:23, Bruce Southey <bsout...@gmail.com> wrote:
>> On 04/21/2010 02:45 PM, Robert Kern wrote:
>>> On Wed, Apr 21, 2010 at 10:34, Bruce Southey<bsout...@gmail.com>  wrote:
>
>>>> If the sum of axis to be removed equals zero then you can conditionally
>>>> remove that axis.
>>>>
>>> No. Negative numbers can cancel out positive numbers.
>>>
>> In such cases you can use the sum of the absolute value of the array or
>> the sum of a suitability constructed boolean indicator for the selected
>> axis. In the case of floating point dtypes, compare it to a value near
>> zero rather than exactly zero.
>
> Or you can use numpy.nonzero(...).any().

Or really just .any().

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to