|
10 | 10 | import pandas as pd
|
11 | 11 | import pandas._testing as tm
|
12 | 12 | from pandas.api.extensions import register_extension_dtype
|
13 |
| -from pandas.api.types import is_scalar |
14 | 13 | from pandas.arrays import (
|
15 | 14 | BooleanArray,
|
16 | 15 | DatetimeArray,
|
@@ -391,61 +390,3 @@ def test_array_not_registered(registry_without_decimal):
|
391 | 390 | result = pd.array(data, dtype=DecimalDtype)
|
392 | 391 | expected = DecimalArray._from_sequence(data)
|
393 | 392 | tm.assert_equal(result, expected)
|
394 |
| - |
395 |
| - |
396 |
| -class TestArrayAnalytics: |
397 |
| - def test_searchsorted(self, string_dtype): |
398 |
| - arr = pd.array(["a", "b", "c"], dtype=string_dtype) |
399 |
| - |
400 |
| - result = arr.searchsorted("a", side="left") |
401 |
| - assert is_scalar(result) |
402 |
| - assert result == 0 |
403 |
| - |
404 |
| - result = arr.searchsorted("a", side="right") |
405 |
| - assert is_scalar(result) |
406 |
| - assert result == 1 |
407 |
| - |
408 |
| - def test_searchsorted_numeric_dtypes_scalar(self, any_real_numpy_dtype): |
409 |
| - arr = pd.array([1, 3, 90], dtype=any_real_numpy_dtype) |
410 |
| - result = arr.searchsorted(30) |
411 |
| - assert is_scalar(result) |
412 |
| - assert result == 2 |
413 |
| - |
414 |
| - result = arr.searchsorted([30]) |
415 |
| - expected = np.array([2], dtype=np.intp) |
416 |
| - tm.assert_numpy_array_equal(result, expected) |
417 |
| - |
418 |
| - def test_searchsorted_numeric_dtypes_vector(self, any_real_numpy_dtype): |
419 |
| - arr = pd.array([1, 3, 90], dtype=any_real_numpy_dtype) |
420 |
| - result = arr.searchsorted([2, 30]) |
421 |
| - expected = np.array([1, 2], dtype=np.intp) |
422 |
| - tm.assert_numpy_array_equal(result, expected) |
423 |
| - |
424 |
| - @pytest.mark.parametrize( |
425 |
| - "arr, val", |
426 |
| - [ |
427 |
| - [ |
428 |
| - pd.date_range("20120101", periods=10, freq="2D"), |
429 |
| - pd.Timestamp("20120102"), |
430 |
| - ], |
431 |
| - [ |
432 |
| - pd.date_range("20120101", periods=10, freq="2D", tz="Asia/Hong_Kong"), |
433 |
| - pd.Timestamp("20120102", tz="Asia/Hong_Kong"), |
434 |
| - ], |
435 |
| - [ |
436 |
| - pd.timedelta_range(start="1 day", end="10 days", periods=10), |
437 |
| - pd.Timedelta("2 days"), |
438 |
| - ], |
439 |
| - ], |
440 |
| - ) |
441 |
| - def test_search_sorted_datetime64_scalar(self, arr, val): |
442 |
| - arr = pd.array(arr) |
443 |
| - result = arr.searchsorted(val) |
444 |
| - assert is_scalar(result) |
445 |
| - assert result == 1 |
446 |
| - |
447 |
| - def test_searchsorted_sorter(self, any_real_numpy_dtype): |
448 |
| - arr = pd.array([3, 1, 2], dtype=any_real_numpy_dtype) |
449 |
| - result = arr.searchsorted([0, 3], sorter=np.argsort(arr)) |
450 |
| - expected = np.array([0, 2], dtype=np.intp) |
451 |
| - tm.assert_numpy_array_equal(result, expected) |
0 commit comments