[Numpy-discussion] Replacing NANs
Tue Mar 30 14:02:59 CDT 2010
On 30 March 2010 14:59, Vishal Rana <email@example.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
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
More information about the NumPy-Discussion