|
39 | 39 |
|
40 | 40 | from sdc.datatypes.range_index_type import RangeIndexType |
41 | 41 | from sdc.datatypes.int64_index_type import Int64IndexType |
42 | | -from sdc.datatypes.common_functions import SDCLimitation, _sdc_take |
43 | 42 | from sdc.utilities.utils import sdc_overload, sdc_overload_attribute, sdc_overload_method |
44 | 43 | from sdc.utilities.sdc_typing_utils import TypeChecker, check_is_numeric_array, check_signed_integer |
45 | | -from sdc.functions.numpy_like import getitem_by_mask |
46 | | -from sdc.functions.numpy_like import astype as nplike_astype |
| 44 | +from sdc.functions import numpy_like |
47 | 45 | from numba.core.boxing import box_array, unbox_array |
48 | 46 | from sdc.hiframes.api import fix_df_index |
49 | 47 | from sdc.extensions.indexes.indexes_generic import _check_dtype_param_type |
@@ -128,7 +126,7 @@ def pd_int64_index_ctor_impl(data, dtype=None, copy=False, name=None): |
128 | 126 | _data = fix_df_index(data)._data |
129 | 127 |
|
130 | 128 | if data_dtype_is_int64 == False: # noqa |
131 | | - _data = nplike_astype(_data, dtype=types.int64) |
| 129 | + _data = numpy_like.astype(_data, dtype=types.int64) |
132 | 130 | else: |
133 | 131 | if copy: |
134 | 132 | _data = np.copy(_data) |
@@ -257,13 +255,12 @@ def pd_int64_index_contains_overload(self, val): |
257 | 255 |
|
258 | 256 | def pd_int64_index_contains_impl(self, val): |
259 | 257 | # TO-DO: add operator.contains support for arrays in Numba |
| 258 | + found = 0 |
260 | 259 | for i in prange(len(self._data)): |
261 | 260 | if val == self._data[i]: |
262 | | - break |
263 | | - else: |
264 | | - return False |
| 261 | + found += 1 |
265 | 262 |
|
266 | | - return True |
| 263 | + return found > 0 |
267 | 264 |
|
268 | 265 | return pd_int64_index_contains_impl |
269 | 266 |
|
@@ -291,7 +288,8 @@ def pd_int64_index_copy_overload(self, name=None, deep=False, dtype=None): |
291 | 288 | def pd_int64_index_copy_impl(self, name=None, deep=False, dtype=None): |
292 | 289 |
|
293 | 290 | _name = self._name if keep_name == True else name # noqa |
294 | | - return init_int64_index(self._data, _name) |
| 291 | + new_index_data = self._data if not deep else numpy_like.copy(self._data) |
| 292 | + return init_int64_index(new_index_data, _name) |
295 | 293 |
|
296 | 294 | return pd_int64_index_copy_impl |
297 | 295 |
|
@@ -408,6 +406,10 @@ def pd_int64_index_ravel_overload(self, order='C'): |
408 | 406 | raise TypingError('{} Unsupported parameters. Given order: {}'.format(_func_name, order)) |
409 | 407 |
|
410 | 408 | def pd_int64_index_ravel_impl(self, order='C'): |
| 409 | + # np.ravel argument order is not supported in Numba |
| 410 | + if order != 'C': |
| 411 | + raise ValueError(f"Unsupported value for argument 'order' (only default 'C' is supported)") |
| 412 | + |
411 | 413 | return self.values |
412 | 414 |
|
413 | 415 | return pd_int64_index_ravel_impl |
0 commit comments