Skip to content

Fix 18068: Updates merge_asof error, now outputs datatypes #18082

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

Merged
merged 5 commits into from
Nov 3, 2017

Conversation

manrajgrover
Copy link
Contributor

@jreback jreback added Error Reporting Incorrect or improved errors from pandas Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Nov 2, 2017
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a whatsnew note for 0.21.1 as well.

"must be the same type")
raise MergeError("incompatible merge keys {lkdtype} and "
"{rkdtype}, must be the same type"
.format(lkdtype=lk.dtype, rkdtype=rk.dtype))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might also add an enumerate here to make it even more clear, e.g.

for i, (lk, rk) in enumerate(zip(......))):
    .....
     raise MergeError("incompatible merge key [{i} {lkdtype} and "

@manrajgrover
Copy link
Contributor Author

@jreback Made the requested changes. I have a question though. How should I check whether release notes messages will successfully get parsed? Is there a build command to check that?

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use tm.assert_raises_regex to assert the errors messages

if not is_dtype_equal(lk.dtype, rk.dtype):
raise MergeError("incompatible merge keys, "
"must be the same type")
raise MergeError("incompatible merge keys [{i} {lkdtype} and "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[{i}] other wise this is confusing

@codecov
Copy link

codecov bot commented Nov 3, 2017

Codecov Report

Merging #18082 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18082      +/-   ##
==========================================
- Coverage   91.25%   91.23%   -0.02%     
==========================================
  Files         163      163              
  Lines       50120    50120              
==========================================
- Hits        45737    45728       -9     
- Misses       4383     4392       +9
Flag Coverage Δ
#multiple 89.04% <100%> (ø) ⬆️
#single 40.32% <0%> (-0.06%) ⬇️
Impacted Files Coverage Δ
pandas/core/reshape/merge.py 94.26% <100%> (ø) ⬆️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.75% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0fd3bd7...a81d9dc. Read the comment docs.

@codecov
Copy link

codecov bot commented Nov 3, 2017

Codecov Report

Merging #18082 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18082      +/-   ##
==========================================
- Coverage   91.25%   91.23%   -0.02%     
==========================================
  Files         163      163              
  Lines       50120    50120              
==========================================
- Hits        45737    45728       -9     
- Misses       4383     4392       +9
Flag Coverage Δ
#multiple 89.04% <100%> (ø) ⬆️
#single 40.32% <0%> (-0.06%) ⬇️
Impacted Files Coverage Δ
pandas/core/reshape/merge.py 94.26% <100%> (ø) ⬆️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.75% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0fd3bd7...c532b3b. Read the comment docs.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test which asserts this error message (e.g. use the case from the original issue)

@@ -102,7 +102,7 @@ Sparse
Reshaping
^^^^^^^^^

-
- Error message in ``pd.merge_asof()`` for key datatype mismatch now includes datatype of left and right key (:issue:`18068`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use :func:`merge_asof` so we get the link

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jreback Is there a documentation for syntax to be used for release notes? Also, how can I view rendered version of it?

Making the required change. Also, will add test for the same.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no this is fine

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentation is look at similar notes!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you would have to build the docs to render it

@jreback jreback added this to the 0.21.1 milestone Nov 3, 2017
@jreback jreback merged commit 86e9dcc into pandas-dev:master Nov 3, 2017
@jreback
Copy link
Contributor

jreback commented Nov 3, 2017

thanks @manrajgrover

1kastner pushed a commit to 1kastner/pandas that referenced this pull request Nov 5, 2017
No-Stream pushed a commit to No-Stream/pandas that referenced this pull request Nov 28, 2017
TomAugspurger pushed a commit to TomAugspurger/pandas that referenced this pull request Dec 8, 2017
TomAugspurger pushed a commit that referenced this pull request Dec 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ERR: better error message on merging for incompat types
2 participants