Skip to content

Commit 279fdf6

Browse files
committed
remove import failure
1 parent de44877 commit 279fdf6

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

doc/source/whatsnew/v0.20.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ Bug Fixes
384384

385385
- Bug in ``pd.read_msgpack()`` in which ``Series`` categoricals were being improperly processed (:issue:`14901`)
386386
- Bug in ``Series.ffill()`` with mixed dtypes containing tz-aware datetimes. (:issue:`14956`)
387+
- Bug in ``.replace()`` may result in incorrect dtypes. (:issue:`12747`)
387388

388389

389390

pandas/core/internals.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3236,7 +3236,7 @@ def comp(s):
32363236
return _possibly_compare(values, getattr(s, 'asm8', s),
32373237
operator.eq)
32383238

3239-
def _cast(block, scalar):
3239+
def _cast_scalar(block, scalar):
32403240
dtype, val = _infer_dtype_from_scalar(scalar, pandas_dtype=True)
32413241
if not is_dtype_equal(block.dtype, dtype):
32423242
dtype = _find_common_type([block.dtype, dtype])
@@ -3268,7 +3268,7 @@ def _cast(block, scalar):
32683268
# particular block
32693269
m = masks[i][b.mgr_locs.indexer]
32703270
if m.any():
3271-
b, val = _cast(b, d)
3271+
b, val = _cast_scalar(b, d)
32723272
new_rb.extend(b.putmask(m, val, inplace=True))
32733273
else:
32743274
new_rb.append(b)

pandas/types/cast.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
_ensure_int8, _ensure_int16,
2020
_ensure_int32, _ensure_int64,
2121
_NS_DTYPE, _TD_DTYPE, _INT64_DTYPE,
22-
_DATELIKE_DTYPES, _POSSIBLY_CAST_DTYPES)
22+
_POSSIBLY_CAST_DTYPES)
2323
from .dtypes import ExtensionDtype, DatetimeTZDtype, PeriodDtype
2424
from .generic import ABCDatetimeIndex, ABCPeriodIndex, ABCSeries
2525
from .missing import isnull, notnull

0 commit comments

Comments
 (0)