Skip to content

ENH: add error message for merge with Series GH12081 #12112

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

Closed
wants to merge 1 commit into from

Conversation

dan-tee
Copy link

@dan-tee dan-tee commented Jan 21, 2016

closes #12081

@jreback jreback added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Error Reporting Incorrect or improved errors from pandas labels Jan 22, 2016
@@ -261,6 +261,20 @@ def test_join_on_fails_with_different_column_counts(self):
index=tm.makeCustomIndex(10, 2))
merge(df, df2, right_on='a', left_on=['a', 'b'])

def test_join_on_fails_with_left_series(self):
with tm.assertRaisesRegexp(ValueError, 'Series'):
series = Series([0, 1, 2])
Copy link
Contributor

Choose a reason for hiding this comment

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

iterate thru a bunch of things (e.g. ndarray, number, string) and assert that they raise as well

@jreback jreback added this to the 0.18.0 milestone Jan 22, 2016
@dan-tee
Copy link
Author

dan-tee commented Jan 25, 2016

@jreback incorporated your comments

@@ -261,6 +261,52 @@ def test_join_on_fails_with_different_column_counts(self):
index=tm.makeCustomIndex(10, 2))
merge(df, df2, right_on='a', left_on=['a', 'b'])


def test_join_on_fails_with_left_series(self):
# GH12081
Copy link
Contributor

Choose a reason for hiding this comment

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

you can put all of these test cases in a single test with a loop

@dan-tee
Copy link
Author

dan-tee commented Jan 26, 2016

@jreback true, looks much nicer now.

@jreback
Copy link
Contributor

jreback commented Jan 26, 2016

looks good. can you add a whatsnew note in API changes.

@dan-tee
Copy link
Author

dan-tee commented Jan 26, 2016

@jreback I added the note to whatsnew. I didn't manage to run Sphinx to test build the doc though. Can you give it a spin?

I'll have to clean my development environment and move from using pip to conda. Just don't really have the time now.

@jreback jreback closed this in 5641665 Jan 26, 2016
@jreback
Copy link
Contributor

jreback commented Jan 26, 2016

@dan-tee no looks good. thanks for the PR!

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.

DataFrame.merge with Series should give nice error message
2 participants