“Substitua o Nan Numpy Array” Respostas de código

Python Numpy Array Substitua Nan por String

import numpy as np
l=['foo', 'bar', 'baz', np.nan]

l_new=['missing' if x is np.nan else x for x in l]

print l_new
# Result:
# ['foo', 'bar', 'baz', 'missing']
Powerful Penguin

Substitua o Nan Numpy Array

from numpy import *

a = array([[1, 2, 3], [0, 3, NaN]])
where_are_NaNs = isnan(a)
a[where_are_NaNs] = 0
Condemned Cicada

Respostas semelhantes a “Substitua o Nan Numpy Array”

Perguntas semelhantes a “Substitua o Nan Numpy Array”

Mais respostas relacionadas para “Substitua o Nan Numpy Array” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código