Skip to content

Commit 9d11487

Browse files
committed
Adjust according to comments
1 parent 91d2cfd commit 9d11487

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

doc/source/whatsnew/v0.24.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ Other API Changes
10591059
- Slicing a single row of a DataFrame with multiple ExtensionArrays of the same type now preserves the dtype, rather than coercing to object (:issue:`22784`)
10601060
- :class:`DateOffset` attribute `_cacheable` and method `_should_cache` have been removed (:issue:`23118`)
10611061
- Comparing :class:`Timedelta` to be less or greater than unknown types now raises a ``TypeError`` instead of returning ``False`` (:issue:`20829`)
1062-
- :meth:`Series.searchsorted`, when supplied a scalar value to search for, now returns a scalar instead of an array (:issue:`xxxxx`).
1062+
- :meth:`Series.searchsorted`, when supplied a scalar value to search for, now returns a scalar instead of an array (:issue:`23801`).
10631063
- :meth:`Categorical.searchsorted`, when supplied a scalar value to search for, now returns a scalar instead of an array (:issue:`23466`).
10641064
- :meth:`Categorical.searchsorted` now raises a ``KeyError`` rather that a ``ValueError``, if a searched for key is not found in its categories (:issue:`23466`).
10651065
- :meth:`Index.hasnans` and :meth:`Series.hasnans` now always return a python boolean. Previously, a python or a numpy boolean could be returned, depending on circumstances (:issue:`23294`).

pandas/core/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ def factorize(self, sort=False, na_sentinel=-1):
13531353
same shape as `value`.
13541354
13551355
.. versionchanged :: 0.24.0
1356-
Ìf `value`is a scalar, an int is now always returned.
1356+
If `value` is a scalar, an int is now always returned.
13571357
Previously, scalar inputs returned an 1-item array for
13581358
:class:`Series` and :class:`Categorical`.
13591359

pandas/tests/indexes/multi/test_monotonic.py

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import pandas as pd
77
from pandas import Index, IntervalIndex, MultiIndex
8+
import pandas.util.testing as tm
89

910

1011
def test_is_monotonic_increasing():
@@ -182,22 +183,28 @@ def test_searchsorted_monotonic(indices):
182183
# test searchsorted only for increasing
183184
if indices.is_monotonic_increasing:
184185
ssm_left = indices._searchsorted_monotonic(value, side='left')
186+
assert tm.is_scalar(ssm_left)
185187
assert expected_left == ssm_left
186188

187189
ssm_right = indices._searchsorted_monotonic(value, side='right')
190+
assert tm.is_scalar(ssm_right)
188191
assert expected_right == ssm_right
189192

190193
ss_left = indices.searchsorted(value, side='left')
194+
assert tm.is_scalar(ss_left)
191195
assert expected_left == ss_left
192196

193197
ss_right = indices.searchsorted(value, side='right')
198+
assert tm.is_scalar(ss_right)
194199
assert expected_right == ss_right
195200

196201
elif indices.is_monotonic_decreasing:
197202
ssm_left = indices._searchsorted_monotonic(value, side='left')
203+
assert tm.is_scalar(ssm_left)
198204
assert expected_left == ssm_left
199205

200206
ssm_right = indices._searchsorted_monotonic(value, side='right')
207+
assert tm.is_scalar(ssm_right)
201208
assert expected_right == ssm_right
202209

203210
else:

pandas/util/testing.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
is_bool, is_categorical_dtype, is_datetime64_dtype, is_datetime64tz_dtype,
2828
is_datetimelike_v_numeric, is_datetimelike_v_object,
2929
is_extension_array_dtype, is_interval_dtype, is_list_like, is_number,
30-
is_period_dtype, is_scalar, is_sequence, is_timedelta64_dtype,
31-
needs_i8_conversion) # noqa
30+
is_period_dtype, is_sequence, is_timedelta64_dtype, needs_i8_conversion)
31+
from pandas.core.dtypes.common import is_scalar # noqa: F401
3232
from pandas.core.dtypes.missing import array_equivalent
3333

3434
import pandas as pd

0 commit comments

Comments
 (0)