BUG: inconsistency in dtype of replace() #44864
Labels
Bug
Dtype Conversions
Unexpected or buggy dtype conversions
Regression
Functionality that used to work in a prior pandas version
Milestone
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
Issue Description
dtype of replace() is different based on regex. When regex=False, dtype is int64. But when regex=True, dtype is object.
Expected Behavior
dtype in both cases should be the same, int64, as value=1
Installed Versions
INSTALLED VERSIONS
commit : 66e3805
python : 3.9.5.final.0
python-bits : 64
OS : Linux
OS-release : 5.11.0-41-generic
Version : #45-Ubuntu SMP Fri Nov 5 11:37:01 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : en_US.utf8
LANG : en_US.utf8
LOCALE : en_US.UTF-8
pandas : 1.3.5
numpy : 1.21.4
pytz : 2021.3
dateutil : 2.8.1
pip : 20.3.4
setuptools : 52.0.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 7.30.1
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.4.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.7.3
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
None
The text was updated successfully, but these errors were encountered: