Skip to content

Conversation

@fujiaxiang
Copy link
Contributor

@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
Contributor 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
@fujiaxiang fujiaxiang requested a review from WillAyd December 24, 2019 17:07
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?

@fujiaxiang fujiaxiang requested a review from WillAyd December 25, 2019 00:03
@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