NaN « numpy « Python Data Type Q&A

Home
Python Data Type Q&A
1.array
2.date
3.dictionary
4.Format
5.integer
6.List
7.numpy
8.regex
9.string
10.tuple
Python Data Type Q&A » numpy » NaN 

1. removing pairs of elements from numpy arrays that are NaN (or another value) in Python    stackoverflow.com

I have an array with two columns in numpy. For example:

a = array([[1, 5, nan, 6],
           [10, 6, 6, nan]])
a = ...

2. Is there a better way of making numpy.argmin() ignore NaN values    stackoverflow.com

I want to get the index of the min value of a numpy array that contains NaNs and I want them ignored

>>> a = array([ nan,   2.5,   ...

3. "isnotnan" functionality in numpy, can this be more pythonic?    stackoverflow.com

I need a function that returns non-NaN values from an array. Currently I am doing it this way:

>>> a = np.array([np.nan, 1, 2])
>>> a
array([ NaN,   1.,   2.])

>>> ...

4. NaNs as key in dictionaries    stackoverflow.com

Can anyone explain the following behaviour to me?

>>> import numpy as np
>>> {np.nan: 5}[np.nan]
5
>>> {float64(np.nan): 5}[float64(np.nan)]
KeyError: nan
Why does it work in the first case, but not in the second? Additionally, I found ...

5. Interpolate NaN values in a numpy array    stackoverflow.com

Is there a quick way of replacing all NaN values in a numpy array with (say) the linearly interpolated values? For example,

[1 1 1 nan nan 2 2 nan 0]
would be ...

6. Numpy - Replace a number with NaN    stackoverflow.com

I am looking to replace a number with NaN in numpy and am looking for a function like numpy.nan_to_num, except in reverse. The number is likely to change as different arrays are ...

7. matplotlib.mlab.griddata very slow and returns array of nan when valid data is input    stackoverflow.com

I am trying to map an irregularly gridded dataset (raw satellite data) with associated latitudes and longitudes to a regularly gridded set of latitudes and longitudes given by basemap.makegrid(). I ...

8. from numpy arrray with NaN into masked array    python-forum.org

Dear all I have numpy array "data" of size 31x11 that has some NaN in it. I would like to plot it. I have x of size 1X31 and y of size 1x11. I would like to plot my "data" using pcolor. How to do it? pcolor(x,y,data) does not work. First it complains about the size of my x and y? ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.