Skip to content

Commit 6729d2e

Browse files
committed
dtype fix for GH9804 on win32
1 parent 2ae575c commit 6729d2e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/core/generic.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -3341,7 +3341,10 @@ def where(self, cond, other=np.nan, inplace=False, axis=None, level=None,
33413341

33423342
matches = (new_other == np.array(other))
33433343
if matches is False or not matches.all():
3344-
other = np.array(other)
3344+
try:
3345+
other = np.array(other, dtype=self.dtype)
3346+
except ValueError:
3347+
other = np.array(other)
33453348

33463349
# we can't use our existing dtype
33473350
# because of incompatibilities

0 commit comments

Comments
 (0)