[SciPy-User] How to ignore NaN values and -32767 in numpy array

Robert Kern robert.kern at gmail.com
Fri Aug 19 13:18:50 EDT 2011


On Fri, Aug 19, 2011 at 00:01, questions anon <questions.anon at gmail.com> wrote:
> Thank you, what you suggested worked but now I don't think that is my
> problem.
> Within the dataset I am trying to calculate the mean from it appears there
> are some hours with no data, the output is:
> [[[-- -- -- ..., -- -- --]
>   [-- -- -- ..., -- -- --]
>   [-- -- -- ..., -- -- --]
>   ...,
>   [-- -- -- ..., -- -- --]
>   [-- -- -- ..., -- -- --]
>   [-- -- -- ..., -- -- --]]]
> So I would assume these would be ignored when I calculate the mean but when
> I make all my files/times into one big array these blanks turn into -32767.
> Is there some way to avoid this?

This is just how large arrays get summarized when printed. The data is
all there. You can control how this summarization happens using the
threshold parameter to numpy.set_printoptions():

http://docs.scipy.org/doc/numpy/reference/generated/numpy.set_printoptions.html

-- 
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



More information about the SciPy-User mailing list