📅  最后修改于: 2022-03-11 14:46:32.658000             🧑  作者: Mango
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']