BUG: Regression in version 1.3.0: outer/right merge converts Int64 column to object if side-specific values are present #42388
Labels
Closing Candidate
May be closeable, needs more eyeballs
Duplicate Report
Duplicate issue or pull request
ExtensionArray
Extending pandas with custom dtypes or arrays.
Regression
Functionality that used to work in a prior pandas version
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
[x ] I have checked that this issue has not already been reported.
[x ] I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
When merging data frames on an Int64 column, the resulting dtype differs between pandas 1.2.5 and 1.3.0.
Code Sample, a copy-pastable example
ALL VALUES IDENTICAL: Correct behaviour
SIDE-SPECIFIC VALUES PRESENT: Differing behaviour, regression on 1.3.0
Problem description
When merging on an Int64 column, the Int64 dtype is lost in certain circumstances (outer and right joins, side-specific values present).
I found this when matches of a merged Int64 key against other Int64 columns silently stopped matching after the update to 1.3.0.
On 1.2.5, there was no problem, as int64 columns match correctly against Int64 ones.
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : f00ed8f
python : 3.8.10.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19042
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : German_Switzerland.1252
pandas : 1.3.0
numpy : 1.20.2
pytz : 2021.1
dateutil : 2.8.1
pip : 21.1.3
setuptools : 51.0.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.8.6 (dt dec pq3 ext lo64)
jinja2 : None
IPython : 7.25.0
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 : 4.0.0
pyxlsb : None
s3fs : None
scipy : 1.6.3
sqlalchemy : 1.4.0b1
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: