Skip to content

FIX: query() and isin() fail on period type column #54214

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 2 commits into from

Conversation

dannyi96
Copy link
Contributor

@dannyi96 dannyi96 commented Jul 20, 2023

@dannyi96 dannyi96 changed the title 54199: .query() and isin() fail on period type column FIX: query() and isin() fail on period type column Jul 20, 2023
@dannyi96 dannyi96 marked this pull request as draft July 21, 2023 02:56
@@ -501,6 +502,8 @@ def isin(comps: ListLike, values: ListLike) -> npt.NDArray[np.bool_]:
comps_array = extract_array(comps_array, extract_numpy=True)
if not isinstance(comps_array, np.ndarray):
# i.e. Extension Array
if isinstance(comps_array.dtype, PeriodDtype):
comps_array = comps_array.to_timestamp()
return comps_array.isin(values)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

2 testcases fail post this change, looking into it

FAILED pandas/tests/indexes/test_datetimelike.py::TestDatetimeLike::test_isin[simple_index0] - TypeError: Passing PeriodDtype data is invalid. Use `data.to_timestamp()` instead
FAILED pandas/tests/series/methods/test_isin.py::TestSeriesIsIn::test_isin_period_freq_mismatch - TypeError: Passing PeriodDtype data is invalid. Use `data.to_timestamp()` instead

@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Aug 21, 2023
@mroeschke
Copy link
Member

Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.

@mroeschke mroeschke closed this Aug 25, 2023
@dannyi96
Copy link
Contributor Author

dannyi96 commented Sep 7, 2023

hi @mroeschke , I've made some changes to address the failing testcases and pushed to this branch dannyi96:period_type_issue.
Do i create a new PR & discard this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: .query() and isin() fail on period type column
2 participants