Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Inconsistent ordering of rows when merging with how=left and how=right #35382

Closed
2 of 3 tasks
pandamatic opened this issue Jul 22, 2020 · 1 comment · Fixed by #37406
Closed
2 of 3 tasks

BUG: Inconsistent ordering of rows when merging with how=left and how=right #35382

pandamatic opened this issue Jul 22, 2020 · 1 comment · Fixed by #37406
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Milestone

Comments

@pandamatic
Copy link

  • 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

import pandas as pd
df = pd.DataFrame({'a': [1, 0, 1]})

df.merge(df, on='a', how='left', sort=False)

	a
0	1
1	1
2	0
3	1
4	1


df.merge(df, on='a', how='right', sort=False)

	a
0	1
1	1
2	1
3	1
4	0

Problem description

Order of output rows should be the same for how=left and how=right in this case.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : None
python : 3.8.2.final.0
python-bits : 64
OS : Linux
OS-release : 4.14.181-140.257.amzn2.x86_64
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : fr_FR.UTF-8
LOCALE : fr_FR.UTF-8

pandas : 1.0.5
numpy : 1.19.0
pytz : 2020.1
dateutil : 2.8.1
pip : 19.2.3
setuptools : 41.2.0
Cython : None
pytest : 5.4.3
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.16.1
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 0.17.1
pytables : None
pytest : 5.4.3
pyxlsb : None
s3fs : 0.4.2
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None

@pandamatic pandamatic added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 22, 2020
@simonjayhawkins
Copy link
Member

Thanks @pandamatic for the report. #33554 maybe related.

@simonjayhawkins simonjayhawkins added Reshaping Concat, Merge/Join, Stack/Unstack, Explode and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 23, 2020
@jreback jreback added this to the 1.2 milestone Oct 31, 2020
@jreback jreback modified the milestones: 1.2, Contributions Welcome Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants