[Numpy-discussion] Replacing NANs
amcmorl at gmail.com
Tue Mar 30 15:02:59 EDT 2010
On 30 March 2010 14:59, Vishal Rana <ranavishal at gmail.com> wrote:
> In an array I want to replace all NANs with some number say 100, I found a
> method nan_to_num but it only replaces with zero.
> Any solution for this?
ar[np.isnan(ar)] = my_num
where ar is your array and my_num is the number you want to replace nans with.
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
More information about the NumPy-Discussion