def pd_fix_indexes_join_impl(joined, indexer1, indexer2): if indexer1 is not None: _indexer1 = _nonoptional(indexer1) else: _indexer1 = np.arange(len(joined)) if indexer2 is not None: _indexer2 = _nonoptional(indexer2) else: _indexer2 = _indexer1 return joined, _indexer1, _indexer2
def impl(d): status, keyval = _dict_popitem(d) if status == Status.OK: return _nonoptional(keyval) elif status == Status.ERR_DICT_EMPTY: raise KeyError() else: raise AssertionError('internal dict error during popitem')
def integer_non_none_impl(l, index): index = handle_index(l, index) castedindex = _cast(index, indexty) status, item = _list_getitem(l, castedindex) if status == ListStatus.LIST_OK: return _nonoptional(item) else: raise AssertionError("internal list error during getitem")
def impl(d, key): castedkey = _cast(key, keyty) ix, val = _dict_lookup(d, castedkey, hash(castedkey)) if ix == DKIX.EMPTY: raise KeyError() elif ix < DKIX.EMPTY: raise AssertionError("internal dict error during lookup") else: return _nonoptional(val)
def impl(l, index=-1): if len(l) == 0: raise IndexError("pop from empty list") index = handle_index(l, index) castedindex = _cast(index, indexty) status, item = _list_pop(l, castedindex) if status == ListStatus.LIST_OK: return _nonoptional(item) else: raise AssertionError("internal list error during pop")
def sdc_reindex_series_impl(arr, index, name, by_index): _, new_order = index.reindex(by_index) if new_order is not None: new_order_as_array = _nonoptional(new_order) index_mismatch = 0 for i in numba.prange(len(by_index)): if new_order_as_array[i] == -1: index_mismatch += 1 if index_mismatch: # TO-DO: seems it covers only specific series reindex case, generalize? msg = "Unalignable boolean Series provided as indexer " + \ "(index of the boolean Series and of the indexed object do not match)." raise IndexingError(msg) res_data = numpy_like.take(arr, new_order_as_array) else: res_data = arr return pandas.Series(data=res_data, index=by_index, name=name)
def impl(lst, index): index = fix_index(lst, index) castedindex = _cast(index, types.intp) _, item = _list_getitem(lst, castedindex) return _nonoptional(item)