Pandas apply to all values except missing

Viewed 7463

Say I had a series such as:

[1,2, NAN, 4]

If I did:

series.apply(lambda a: a+2)

I would get an error due to the NAN. Is there an elegant way to preserve the NANs while applying my change?

1 Answers
Related