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: Fix wrong error in df drop with non unique datetime index and invalid keys #30446

Conversation

fujiaxiang
Copy link
Member

@fujiaxiang fujiaxiang commented Dec 24, 2019

@fujiaxiang fujiaxiang changed the title Fix wrong error in df drop with non unique datetime index and invalid keys BUG: Fix wrong error in df drop with non unique datetime index and invalid keys Dec 24, 2019
# create dataframe with non-unique datetime index
df_nonunique = df_unique.copy().iloc[[0, 2, 2, 3]]

try:
Copy link
Member

Choose a reason for hiding this comment

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

I think the point of this is the raise a KeyError for the example specified - can you model the test to use pytest.raises instead? Should see other examples of this in the code base

Copy link
Member Author

Choose a reason for hiding this comment

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

Have updated the code as requested. Now the test specifically expects KeyError with string "not found in axis" within the message

@WillAyd WillAyd added the Error Reporting Incorrect or improved errors from pandas label Dec 24, 2019
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

Looks good minor nit on whatsnew - @jorisvandenbossche care to look?

doc/source/whatsnew/v1.0.0.rst Outdated Show resolved Hide resolved
Co-Authored-By: William Ayd <william.ayd@icloud.com>
@jreback jreback added this to the 1.0 milestone Dec 26, 2019
@jreback jreback merged commit e46026f into pandas-dev:master Dec 26, 2019
@jreback
Copy link
Contributor

jreback commented Dec 26, 2019

thanks @fujiaxiang

@fujiaxiang fujiaxiang deleted the fix_wrong_error_in_df_drop_with_non_unique_datetime_index_and_invalid_keys branch December 26, 2019 01:33
fujiaxiang added a commit to fujiaxiang/pandas that referenced this pull request Dec 26, 2019
AlexKirko pushed a commit to AlexKirko/pandas that referenced this pull request Dec 29, 2019
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG/ERR: wrong error in DataFrame.drop with non-unique datetime index + invalid keys
3 participants