From 02ebf34184dfe7ec3a46c52d059682bb446ffae7 Mon Sep 17 00:00:00 2001 From: Patrick Luo Date: Wed, 8 Mar 2017 12:50:02 -0500 Subject: [PATCH] handle nan values in DataFrame.update when overwrite=False #15593 #15593 --- pandas/core/frame.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 4e7a5ebdf6f67..c4abbaecb00e9 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -3846,13 +3846,13 @@ def update(self, other, join='left', overwrite=True, filter_func=None, if overwrite: mask = isnull(that) - - # don't overwrite columns unecessarily - if mask.all(): - continue else: mask = notnull(this) + # don't overwrite columns unecessarily + if mask.all(): + continue + self[col] = expressions.where(mask, this, that, raise_on_error=True)