|
32 | 32 | from pandas.core.base import FrozenList
|
33 | 33 | import pandas.core.base as base
|
34 | 34 | from pandas.util.decorators import (Appender, cache_readonly,
|
35 |
| - deprecate, deprecate_kwarg) |
| 35 | + deprecate, deprecate_kwarg, |
| 36 | + Substitution) |
| 37 | + |
36 | 38 | import pandas.core.common as com
|
37 | 39 | import pandas.core.missing as missing
|
38 | 40 | import pandas.core.algorithms as algos
|
@@ -1470,6 +1472,26 @@ def get_indexer(self, target, method=None, limit=None, tolerance=None):
|
1470 | 1472 |
|
1471 | 1473 | return _ensure_platform_int(indexer)
|
1472 | 1474 |
|
| 1475 | + def searchsorted(self, value, side='left', sorter=None): |
| 1476 | + ans = [] |
| 1477 | + for val in value: |
| 1478 | + left_index=0 |
| 1479 | + right_index=None |
| 1480 | + for dim in range(0,self.labels.__len__()): |
| 1481 | + v=self.levels[dim][self.labels[dim]] |
| 1482 | + if right_index==None: right_index=len(v) |
| 1483 | + v=v[left_index:right_index] |
| 1484 | + if (dim<self.labels.__len__()-1): |
| 1485 | + left_addition = v.searchsorted(val[dim],'left') |
| 1486 | + right_addition = v.searchsorted(val[dim],'right') |
| 1487 | + right_index=left_index+right_addition |
| 1488 | + left_index=left_index+left_addition |
| 1489 | + else: |
| 1490 | + ans.append(left_index+ v.searchsorted(val[dim],side)) |
| 1491 | + return ans |
| 1492 | + |
| 1493 | + |
| 1494 | + |
1473 | 1495 | def reindex(self, target, method=None, level=None, limit=None,
|
1474 | 1496 | tolerance=None):
|
1475 | 1497 | """
|
|
0 commit comments