You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have checked that this issue has not already been reported.
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.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
#Different label names 'A' and 'a'testa=pd.DataFrame([{"A":1,"b":2}])
testb=pd.DataFrame([{"a":2,"c":2}])
result=pd.merge(testa, testb, left_on='A', right_on='a', how="outer")
result.dtypesOut[1]:
Afloat64bfloat64afloat64cfloat64dtype: object#Same lable name with on[''] methond looks finetesta=pd.DataFrame([{"a":1,"b":2}])
testb=pd.DataFrame([{"a":2,"c":2}])
result1=pd.merge(testa, testb, on=["a"], how="outer")
result1.dtypesOut[2]:
aint64bfloat64cfloat64dtype: object
Problem description
I was merging some df with the zipcode, so I found this might be a problem. Maybe I am wrong about this, and probably pandas designed this way for some reasons? I don't know. If anyone knows the reasons why it had built this way, please share.
I also came across with this post: #9958
Expected Output
I expecte there's no data type changes after merging.
Output of pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.6.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en
LOCALE : None.None
Silently casting from int64 to float64 is very common, and may cause some problem (e.g people might try to downcast float64 to int64 again), I think we should raise a warning or document it somewhere
Uh oh!
There was an error while loading. Please reload this page.
I have checked that this issue has not already been reported.
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.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
I was merging some df with the zipcode, so I found this might be a problem. Maybe I am wrong about this, and probably pandas designed this way for some reasons? I don't know. If anyone knows the reasons why it had built this way, please share.
I also came across with this post: #9958
Expected Output
I expecte there's no data type changes after merging.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.6.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en
LOCALE : None.None
pandas : 1.0.1
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 45.2.0.post20200210
Cython : 0.29.15
pytest : 5.3.5
hypothesis : 5.5.4
sphinx : 2.4.0
blosc : None
feather : None
xlsxwriter : 1.2.7
lxml.etree : 4.5.0
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.1
IPython : 7.12.0
pandas_datareader: None
bs4 : 4.8.2
bottleneck : 1.3.2
fastparquet : None
gcsfs : None
lxml.etree : 4.5.0
matplotlib : 3.1.3
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.3
pandas_gbq : None
pyarrow : None
pytables : None
pytest : 5.3.5
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : 1.3.13
tables : 3.6.1
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.2.7
numba : 0.48.0
The text was updated successfully, but these errors were encountered: