-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: Series.searchsorted(...)
fails with Timestamp
DataFrame
s
#49620
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
Comments
I have reproduced this issue on the main branch. I also tried |
i don't think it is, this should raise consistently |
Raise error when DataFrame is passed to searchsorted
Raise error when DataFrame is passed to searchsorted
Raise error when DataFrame is passed to searchsorted
* Bug: Fix inconsistent behavior in searchsorted (#49620) Raise error when DataFrame is passed to searchsorted * Update v2.0.0.rst * Revert "Update v2.0.0.rst" This reverts commit 0b1b450. * Update whatsnew * Update v2.0.0.rst * Update base.py * Revert "Update base.py" This reverts commit 090bd79. * Bug: Fix inconsistent behavior in searchsorted (#49620) Raise error when DataFrame is passed to searchsorted * Update whatsnew * Bug: Fix inconsistent behavior in searchsorted (#49620) Raise error when DataFrame is passed to searchsorted * Add test for failure on DataFrame * Add test for failure on DataFrame * Add test for failure on DataFrame * Add test for failure on DataFrame * Bug: Fix inconsistent behavior in searchsorted (#49620) * Add test for failure on DataFrame
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
Series.searchsorted
has inconsistent behavior that depends on the datadtype
when aDataFrame
is passed as the inputvalue
. In the above code snippet, when the inputDataFrame
containsint
data, things run successfullyHowever, when the input
DataFrame
containsTimestamp
data, things fails withTypeError: value should be a 'Timestamp', 'NaT', or array of those. Got 'StringArray' instead.
(full traceback below)I should also note that if we remove the
pd.DataFrame()
calls above and passSeries
objects tosearchsorted
, then both examples pass.Expected Behavior
Based on the
Series.searchsorted
docstring, it's not clear to me ifvalue
beingDataFrame
is intended to be supported or not. If it is intended to be supported, then I'd expectTimestamp
data to work in the code snippet above. If it's not intended to be supported, then I'd expect theint
data example to raise an error (it currently doesn't).Installed Versions
The text was updated successfully, but these errors were encountered: