From b183b85b5ed5a3d93ffd4399acbb66a6e23b3a32 Mon Sep 17 00:00:00 2001 From: Amanda Potts Date: Tue, 4 Jun 2024 17:37:19 -0400 Subject: [PATCH] Closes #3281 rename bool to bool_ to match numpy --- PROTO_tests/tests/dataframe_test.py | 4 +-- PROTO_tests/tests/dtypes_test.py | 8 ++--- PROTO_tests/tests/groupby_test.py | 12 +++---- PROTO_tests/tests/indexing_test.py | 8 ++--- PROTO_tests/tests/io_test.py | 4 +-- PROTO_tests/tests/message_test.py | 2 +- PROTO_tests/tests/numeric_test.py | 16 ++++----- PROTO_tests/tests/numpy/numpy_numeric_test.py | 4 +-- PROTO_tests/tests/pdarray_creation_test.py | 18 +++++----- PROTO_tests/tests/random_test.py | 6 ++-- PROTO_tests/tests/segarray_test.py | 28 +++++++-------- PROTO_tests/tests/series_test.py | 8 ++--- PROTO_tests/tests/setops_test.py | 12 +++---- PROTO_tests/tests/sort_test.py | 2 +- PROTO_tests/tests/string_test.py | 4 +-- PROTO_tests/tests/symbol_table_test.py | 6 ++-- PROTO_tests/tests/where_test.py | 2 +- arkouda/array_api/searching_functions.py | 2 +- arkouda/categorical.py | 2 +- arkouda/dataframe.py | 3 +- arkouda/dtypes.py | 16 ++++----- arkouda/index.py | 2 +- arkouda/numeric.py | 6 ++-- arkouda/numpy/_numeric.py | 7 +++- arkouda/pdarrayclass.py | 5 ++- arkouda/pdarraycreation.py | 14 ++++---- arkouda/pdarraysetops.py | 7 ++-- arkouda/random/_generator.py | 2 +- arkouda/random/_legacy.py | 2 +- arkouda/segarray.py | 2 +- benchmarks/sort-cases.py | 2 +- pydoc/usage/indexing.rst | 2 +- tests/array_api/util_functions.py | 4 +-- tests/deprecated/ak_test.py | 22 ++++++------ tests/deprecated/dataframe_test.py | 2 +- tests/deprecated/dtypes_tests.py | 17 ++++++++-- tests/deprecated/numeric_test.py | 10 +++--- tests/io_test.py | 10 +++--- tests/operator_tests.py | 6 ++-- tests/parquet_test.py | 18 +++++----- tests/pdarray_creation_test.py | 34 +++++++++---------- tests/random_test.py | 6 ++-- tests/segarray_test.py | 2 +- tests/sort_test.py | 2 +- tests/string_test.py | 6 ++-- tests/where_test.py | 2 +- 46 files changed, 187 insertions(+), 172 deletions(-) diff --git a/PROTO_tests/tests/dataframe_test.py b/PROTO_tests/tests/dataframe_test.py index 2a04a5e62d..814db4cf91 100644 --- a/PROTO_tests/tests/dataframe_test.py +++ b/PROTO_tests/tests/dataframe_test.py @@ -1168,7 +1168,7 @@ def test_dropna(self): ) def test_memory_usage(self): - dtypes = [ak.int64, ak.float64, ak.bool] + dtypes = [ak.int64, ak.float64, ak.bool_] data = dict([(str(t), ak.ones(5000, dtype=ak.int64).astype(t)) for t in dtypes]) df = ak.DataFrame(data) ak_memory_usage = df.memory_usage() @@ -1313,7 +1313,7 @@ def test_sample_flags(self): @pytest.mark.parametrize("size", pytest.prob_size) def test_head_tail(self, size): - bool_col = ak.full(size, False, dtype=ak.bool) + bool_col = ak.full(size, False, dtype=ak.bool_) bool_col[::2] = True df = ak.DataFrame( diff --git a/PROTO_tests/tests/dtypes_test.py b/PROTO_tests/tests/dtypes_test.py index 4447041595..e8a1912b16 100644 --- a/PROTO_tests/tests/dtypes_test.py +++ b/PROTO_tests/tests/dtypes_test.py @@ -95,7 +95,7 @@ def test_nbytes(self, size): ak.dtypes.uint64, ak.dtypes.int64, ak.dtypes.float64, - ak.dtypes.bool, + ak.dtypes.bool_, ] for dt in dtype_list: @@ -109,7 +109,7 @@ def test_nbytes(self, size): def test_pdarrays_datatypes(self): assert dtypes.dtype("int64") == ak.array(np.arange(10)).dtype assert dtypes.dtype("uint64") == ak.array(np.arange(10), ak.uint64).dtype - assert dtypes.dtype("bool") == ak.ones(10, ak.bool).dtype + assert dtypes.dtype("bool") == ak.ones(10, ak.bool_).dtype assert dtypes.dtype("float64") == ak.ones(10).dtype assert dtypes.dtype("str") == ak.random_strings_uniform(1, 16, size=10).dtype @@ -179,13 +179,13 @@ def test_DtypeEnum(self): assert ( frozenset( - {"bool", "float", "float64", "int", "int64", "uint", "uint64", "uint8", "bigint", "str"} + {"bool_", "float", "float64", "int", "int64", "uint", "uint64", "uint8", "bigint", "str"} ) == ak.ARKOUDA_SUPPORTED_DTYPES ) def test_NumericDTypes(self): - num_types = frozenset(["bool", "float", "float64", "int", "int64", "uint64", "bigint"]) + num_types = frozenset(["bool", "bool_", "float", "float64", "int", "int64", "uint64", "bigint"]) assert num_types == dtypes.NumericDTypes def test_SeriesDTypes(self): diff --git a/PROTO_tests/tests/groupby_test.py b/PROTO_tests/tests/groupby_test.py index 6b2f4fefdd..d4fd5b1c4a 100644 --- a/PROTO_tests/tests/groupby_test.py +++ b/PROTO_tests/tests/groupby_test.py @@ -672,8 +672,8 @@ def test_head_aggregation(self, size, dtype): if dtype is ak.str_: v = ak.random_strings_uniform(size=size, minlen=1, maxlen=2) - elif dtype is ak.bool: - v = ak.full(size, False, dtype=ak.bool) + elif dtype is ak.bool_: + v = ak.full(size, False, dtype=ak.bool_) v[::2] = True else: v = ak.arange(size, dtype=dtype) @@ -706,7 +706,7 @@ def test_head_aggregation(self, size, dtype): unique_keys, values = g.head(v, 2, return_indices=False) assert len(values) == len(expected_values) assert ak.all(unique_keys == ak.array([0, 1, 2])) - if dtype == ak.bool: + if dtype == ak.bool_: assert aksum(values) == aksum(expected_values) else: assert set(values.to_list()) == set(expected_values.to_list()) @@ -722,8 +722,8 @@ def test_tail_aggregation(self, size, dtype): if dtype is ak.str_: v = ak.random_strings_uniform(size=size, minlen=1, maxlen=2) - elif dtype is ak.bool: - v = ak.full(size, False, dtype=ak.bool) + elif dtype is ak.bool_: + v = ak.full(size, False, dtype=ak.bool_) v[::2] = True else: v = ak.arange(size, dtype=dtype) @@ -756,7 +756,7 @@ def test_tail_aggregation(self, size, dtype): unique_keys, values = g.tail(v, 2, return_indices=False) assert len(values) == len(expected_values) assert ak.all(unique_keys == ak.array([0, 1, 2])) - if dtype == ak.bool: + if dtype == ak.bool_: assert aksum(values) == aksum(expected_values) else: assert set(values.to_list()) == set(expected_values.to_list()) diff --git a/PROTO_tests/tests/indexing_test.py b/PROTO_tests/tests/indexing_test.py index 4135a30b39..b1d89f827b 100644 --- a/PROTO_tests/tests/indexing_test.py +++ b/PROTO_tests/tests/indexing_test.py @@ -3,7 +3,7 @@ import arkouda as ak -NUM_TYPES = [ak.int64, ak.uint64, ak.float64, ak.bool, ak.bigint] +NUM_TYPES = [ak.int64, ak.uint64, ak.float64, ak.bool_, ak.bigint] def key_arrays(size): @@ -17,7 +17,7 @@ def value_array(dtype, size): return ak.randint(-size, size, size, dtype=dtype) elif dtype is ak.uint64: return ak.randint(0, size, size, dtype=dtype) - elif dtype is ak.bool: + elif dtype is ak.bool_: return (ak.randint(0, size, size) % 2) == 0 elif dtype is ak.bigint: return ak.randint(0, size, size, dtype=ak.uint64) + 2**200 @@ -31,7 +31,7 @@ def value_scalar(dtype, size): return ak.randint(-size, 0, 1, dtype=dtype) elif dtype is ak.uint64: return ak.randint(2**63, 2**64, 1, dtype=dtype) - elif dtype is ak.bool: + elif dtype is ak.bool_: return (ak.randint(0, 2, 1) % 2) == 0 elif dtype is ak.bigint: return ak.randint(0, size, 1, dtype=ak.uint64) + 2**200 @@ -52,7 +52,7 @@ def test_pdarray_uint_indexing(self, prob_size, dtype): @pytest.mark.parametrize("prob_size", pytest.prob_size) def test_bool_indexing(self, prob_size): u = value_array(ak.uint64, prob_size) - b = value_array(ak.bool, prob_size) + b = value_array(ak.bool_, prob_size) assert u[b].to_list() == ak.cast(u, ak.int64)[b].to_list() assert u[b].to_list() == ak.cast(u, ak.bigint)[b].to_list() diff --git a/PROTO_tests/tests/io_test.py b/PROTO_tests/tests/io_test.py index cac80c8236..38d3d89635 100644 --- a/PROTO_tests/tests/io_test.py +++ b/PROTO_tests/tests/io_test.py @@ -95,7 +95,7 @@ def make_multi_dtype_dict(): "c_3": ak.arange(2**63 + 3, 2**63 + 7, dtype=ak.uint64), "c_4": ak.SegArray(ak.array([0, 5, 10, 10]), ak.arange(2**63, 2**63 + 15, dtype=ak.uint64)), "c_5": ak.array([False, True, False, False]), - "c_6": ak.SegArray(ak.array([0, 0, 5, 10]), ak.randint(0, 1, 15, dtype=ak.bool)), + "c_6": ak.SegArray(ak.array([0, 0, 5, 10]), ak.randint(0, 1, 15, dtype=ak.bool_)), "c_7": ak.array([-0.0, np.finfo(np.float64).min, np.nan, np.inf]), "c_8": ak.SegArray( ak.array([0, 9, 14, 14]), @@ -1145,7 +1145,7 @@ def test_hdf_overwrite_pdarray(self): with tempfile.TemporaryDirectory(dir=TestHDF5.hdf_test_base_tmp) as tmp_dirname: file_name = f"{tmp_dirname}/pda_test" a.to_hdf(file_name) - for size, dtype in [(15, ak.uint64), (150, ak.float64), (1000, ak.bool)]: + for size, dtype in [(15, ak.uint64), (150, ak.float64), (1000, ak.bool_)]: b = ak.arange(size, dtype=dtype) b.update_hdf(file_name) data = ak.read_hdf(f"{file_name}*").popitem()[1] diff --git a/PROTO_tests/tests/message_test.py b/PROTO_tests/tests/message_test.py index 88a619a17e..f9830d1b87 100644 --- a/PROTO_tests/tests/message_test.py +++ b/PROTO_tests/tests/message_test.py @@ -92,7 +92,7 @@ class TestJSONArgs: SCALAR_TYPES = [int, float, bool, str] # The types below are support in arkouda, as noted in serverConfig.json. This may be # the same issue noted in the above comment. - SUPPORTED_TYPES = [ak.bool, ak.uint64, ak.int64, ak.bigint, ak.uint8, ak.float64] + SUPPORTED_TYPES = [ak.bool_, ak.uint64, ak.int64, ak.bigint, ak.uint8, ak.float64] @pytest.mark.parametrize("dtype", SCALAR_TYPES) def test_scalar_args(self, dtype): diff --git a/PROTO_tests/tests/numeric_test.py b/PROTO_tests/tests/numeric_test.py index 5b84fdd8aa..8da898639a 100644 --- a/PROTO_tests/tests/numeric_test.py +++ b/PROTO_tests/tests/numeric_test.py @@ -4,9 +4,9 @@ from arkouda.dtypes import npstr from math import isclose -NUMERIC_TYPES = [ak.int64, ak.float64, ak.bool, ak.uint64] +NUMERIC_TYPES = [ak.int64, ak.float64, ak.bool_, ak.uint64] NO_BOOL = [ak.int64, ak.float64, ak.uint64] -NO_FLOAT = [ak.int64, ak.bool, ak.uint64] +NO_FLOAT = [ak.int64, ak.bool_, ak.uint64] INT_FLOAT = [ak.int64, ak.float64] # There are many ways to create a vector of alternating values. @@ -56,7 +56,7 @@ def alternatingTF(n): # as noted in serverConfig.json, only these types are supported -SUPPORTED_TYPES = [ak.bool, ak.uint64, ak.int64, ak.bigint, ak.uint8, ak.float64] +SUPPORTED_TYPES = [ak.bool_, ak.uint64, ak.int64, ak.bigint, ak.uint8, ak.float64] NP_TRIG_ARRAYS = { @@ -67,7 +67,7 @@ def alternatingTF(n): np.array([np.nan, -np.inf, -0.0, 0.0, np.inf]), ] ), - ak.bool: alternate(True, False, 10), + ak.bool_: alternate(True, False, 10), ak.uint64: np.arange(2**64 - 10, 2**64, dtype=np.uint64), } @@ -83,7 +83,7 @@ def alternatingTF(n): } ROUNDTRIP_CAST = [ - (ak.bool, ak.bool), + (ak.bool_, ak.bool_), (ak.int64, ak.int64), (ak.int64, ak.float64), (ak.int64, npstr), @@ -189,12 +189,12 @@ def test_cast(self, prob_size, cast_to): ak.int64: ak.randint(-(2**48), 2**48, prob_size), ak.uint64: ak.randint(0, 2**48, prob_size, dtype=ak.uint64), ak.float64: ak.randint(0, 1, prob_size, dtype=ak.float64), - ak.bool: ak.randint(0, 2, prob_size, dtype=ak.bool), + ak.bool_: ak.randint(0, 2, prob_size, dtype=ak.bool_), ak.str_: ak.cast(ak.randint(0, 2**48, prob_size), "str"), } for t1, orig in arrays.items(): - if (t1 == ak.float64 and cast_to == ak.bigint) or (t1 == ak.str_ and cast_to == ak.bool): + if (t1 == ak.float64 and cast_to == ak.bigint) or (t1 == ak.str_ and cast_to == ak.bool_): # we don't support casting a float to a bigint # we do support str to bool, but it's expected to contain "true/false" not numerics continue @@ -231,7 +231,7 @@ def test_str_cast_errors(self, num_type): ] ) ans = np.array([1.1, 2.2, np.nan, np.nan, 5.5, 6.6e-6, 78.91e4, 6.0, np.nan]) - elif num_type == ak.bool: + elif num_type == ak.bool_: strarr = ak.array( [ "True", diff --git a/PROTO_tests/tests/numpy/numpy_numeric_test.py b/PROTO_tests/tests/numpy/numpy_numeric_test.py index 4c2138be8c..54d328bfd4 100644 --- a/PROTO_tests/tests/numpy/numpy_numeric_test.py +++ b/PROTO_tests/tests/numpy/numpy_numeric_test.py @@ -3,9 +3,9 @@ import arkouda as ak -NUMERIC_TYPES = [ak.int64, ak.float64, ak.bool, ak.uint64] +NUMERIC_TYPES = [ak.int64, ak.float64, ak.bool_, ak.uint64] NO_BOOL = [ak.int64, ak.float64, ak.uint64] -NO_FLOAT = [ak.int64, ak.bool, ak.uint64] +NO_FLOAT = [ak.int64, ak.bool_, ak.uint64] INT_FLOAT = [ak.int64, ak.float64] diff --git a/PROTO_tests/tests/pdarray_creation_test.py b/PROTO_tests/tests/pdarray_creation_test.py index da849eb4d0..6dec1e137c 100644 --- a/PROTO_tests/tests/pdarray_creation_test.py +++ b/PROTO_tests/tests/pdarray_creation_test.py @@ -174,9 +174,9 @@ def test_arange_misc(self): # test correct conversion to bool expected_bool = [False, True, True, True, True] - ak_arange_bool = ak.arange(0, 10, 2, dtype=ak.bool) + ak_arange_bool = ak.arange(0, 10, 2, dtype=ak.bool_) assert expected_bool == ak_arange_bool.to_list() - assert ak.bool == ak_arange_bool.dtype + assert ak.bool_ == ak_arange_bool.dtype # test int_scalars covers uint8, uint16, uint32 uint_array = ak.arange(np.uint8(1), np.uint16(1000), np.uint32(1)) @@ -256,7 +256,7 @@ def test_randint_with_seed(self): assert ans == values.to_list() bools = [False, True, True, True, True, False, True, True, True, True] - values = ak.randint(1, 5, 10, dtype=ak.bool, seed=2) + values = ak.randint(1, 5, 10, dtype=ak.bool_, seed=2) assert values.to_list() == bools values = ak.randint(1, 5, 10, dtype=bool, seed=2) @@ -295,7 +295,7 @@ def test_uniform(self, size): assert (uint_arr == int_arr).all() @pytest.mark.parametrize("size", pytest.prob_size) - @pytest.mark.parametrize("dtype", [ak.int64, float, ak.float64, bool, ak.bool, ak.bigint]) + @pytest.mark.parametrize("dtype", [ak.int64, float, ak.float64, bool, ak.bool_, ak.bigint]) def test_zeros_dtype(self, size, dtype): zeros = ak.zeros(size, dtype) assert isinstance(zeros, ak.pdarray) @@ -317,7 +317,7 @@ def test_zeros_misc(self): for arg in np.uint8(5), np.uint16(5), np.uint32(5), str(5): assert (int_arr == ak.zeros(arg, dtype=ak.int64)).all() - @pytest.mark.parametrize("dtype", [int, ak.int64, float, ak.float64, bool, ak.bool, ak.bigint]) + @pytest.mark.parametrize("dtype", [int, ak.int64, float, ak.float64, bool, ak.bool_, ak.bigint]) @pytest.mark.parametrize("size", pytest.prob_size) def test_ones_dtype(self, size, dtype): ones = ak.ones(size, dtype) @@ -341,7 +341,7 @@ def test_ones_misc(self): assert (int_arr == ak.ones(arg, dtype=ak.int64)).all() @pytest.mark.parametrize("size", pytest.prob_size) - @pytest.mark.parametrize("dtype", [ak.int64, ak.float64, ak.bool, ak.bigint]) + @pytest.mark.parametrize("dtype", [ak.int64, ak.float64, ak.bool_, ak.bigint]) def test_ones_like(self, size, dtype): ones_arr = ak.ones(size, dtype) ones_like_arr = ak.ones_like(ones_arr) @@ -350,7 +350,7 @@ def test_ones_like(self, size, dtype): assert (1 == ones_like_arr).all() @pytest.mark.parametrize("size", pytest.prob_size) - @pytest.mark.parametrize("dtype", [int, ak.int64, ak.uint64, float, ak.float64, bool, ak.bool]) + @pytest.mark.parametrize("dtype", [int, ak.int64, ak.uint64, float, ak.float64, bool, ak.bool_]) def test_full_dtype(self, size, dtype): type_full = ak.full(size, 1, dtype) assert isinstance(type_full, ak.pdarray) @@ -387,7 +387,7 @@ def test_full_misc(self): assert (int_arr == ak.full(*args, dtype=int)).all() @pytest.mark.parametrize("size", pytest.prob_size) - @pytest.mark.parametrize("dtype", [int, ak.int64, ak.uint64, float, ak.float64, bool, ak.bool]) + @pytest.mark.parametrize("dtype", [int, ak.int64, ak.uint64, float, ak.float64, bool, ak.bool_]) def test_full_like(self, size, dtype): full_arr = ak.full(size, 1, dtype) full_like_arr = ak.full_like(full_arr, 1) @@ -396,7 +396,7 @@ def test_full_like(self, size, dtype): assert (full_like_arr == 1).all() @pytest.mark.parametrize("size", pytest.prob_size) - @pytest.mark.parametrize("dtype", [int, ak.int64, ak.uint64, float, ak.float64, bool, ak.bool]) + @pytest.mark.parametrize("dtype", [int, ak.int64, ak.uint64, float, ak.float64, bool, ak.bool_]) def test_zeros_like(self, size, dtype): zeros_arr = ak.zeros(size, dtype) zeros_like_arr = ak.zeros_like(zeros_arr) diff --git a/PROTO_tests/tests/random_test.py b/PROTO_tests/tests/random_test.py index fa69a9b0a7..524072ca80 100644 --- a/PROTO_tests/tests/random_test.py +++ b/PROTO_tests/tests/random_test.py @@ -363,8 +363,8 @@ def test_legacy_randint(self): test_array = ak.random.randint(0, 1, 3, dtype=ak.float64) assert ak.float64 == test_array.dtype - test_array = ak.random.randint(0, 1, 5, dtype=ak.bool) - assert ak.bool == test_array.dtype + test_array = ak.random.randint(0, 1, 5, dtype=ak.bool_) + assert ak.bool_ == test_array.dtype test_ndarray = test_array.to_ndarray() @@ -423,7 +423,7 @@ def test_legacy_randint_with_seed(self): 4.0337935981006172, ] == values.to_list() - values = ak.random.randint(1, 5, 10, dtype=ak.bool, seed=2) + values = ak.random.randint(1, 5, 10, dtype=ak.bool_, seed=2) assert [False, True, True, True, True, False, True, True, True, True] == values.to_list() values = ak.random.randint(1, 5, 10, dtype=bool, seed=2) diff --git a/PROTO_tests/tests/segarray_test.py b/PROTO_tests/tests/segarray_test.py index 7b48111a78..a31292197a 100644 --- a/PROTO_tests/tests/segarray_test.py +++ b/PROTO_tests/tests/segarray_test.py @@ -6,11 +6,11 @@ import arkouda as ak -DTYPES = [ak.int64, ak.uint64, ak.bigint, ak.float64, ak.bool, ak.str_] +DTYPES = [ak.int64, ak.uint64, ak.bigint, ak.float64, ak.bool_, ak.str_] NO_BOOL = [ak.int64, ak.uint64, ak.bigint, ak.float64, ak.str_] -NO_STR = [ak.int64, ak.uint64, ak.bigint, ak.float64, ak.bool] -NO_FLOAT = [ak.int64, ak.uint64, ak.bigint, ak.str_, ak.bool] -NO_FLOAT_STR = [ak.int64, ak.uint64, ak.bigint, ak.bool] +NO_STR = [ak.int64, ak.uint64, ak.bigint, ak.float64, ak.bool_] +NO_FLOAT = [ak.int64, ak.uint64, ak.bigint, ak.str_, ak.bool_] +NO_FLOAT_STR = [ak.int64, ak.uint64, ak.bigint, ak.bool_] SETOPS = ["intersect", "union", "setdiff", "setxor"] @@ -28,7 +28,7 @@ def make_segarray(size, dtype): alpha_num = list(ascii_letters + digits) np_codes = np.random.choice(alpha_num, size=[size, 2]) vals = np.array(["".join(code) for code in np_codes]) - elif dtype == ak.bool: + elif dtype == ak.bool_: vals = np.random.randint(0, 2, size, dtype=dtype) else: vals = None @@ -51,7 +51,7 @@ def make_segarray_edge(dtype): alpha_num = list(ascii_letters + digits) np_codes = np.random.choice(alpha_num, size=[10, 2]) vals = np.array(["".join(code) for code in np_codes]) - elif dtype == ak.bool: + elif dtype == ak.bool_: vals = np.random.randint(0, 2, 10, dtype=dtype) else: vals = None @@ -71,7 +71,7 @@ def make_concat_segarray(dtype): alpha_num = list(ascii_letters + digits) np_codes = np.random.choice(alpha_num, size=[10, 2]) vals = np.array(["".join(code) for code in np_codes]) - elif dtype == ak.bool: + elif dtype == ak.bool_: vals = np.random.randint(0, 2, 10, dtype=dtype) else: vals = None @@ -79,7 +79,7 @@ def make_concat_segarray(dtype): return segs, vals def make_append_error_checks(self, dtype): - if dtype in [ak.int64, ak.uint64, ak.bigint, ak.bool]: + if dtype in [ak.int64, ak.uint64, ak.bigint, ak.bool_]: return self.make_concat_segarray(ak.float64) else: return self.make_concat_segarray(ak.int64) @@ -96,7 +96,7 @@ def build_single_append_array(size, dtype): alpha_num = list(ascii_letters + digits) np_codes = np.random.choice(alpha_num, size=[size, 2]) vals = np.array(["".join(code) for code in np_codes]) - elif dtype == ak.bool: + elif dtype == ak.bool_: vals = np.random.randint(0, 2, size, dtype=dtype) else: vals = None @@ -108,7 +108,7 @@ def get_append_scalar(self, dtype): return 99 elif dtype == ak.bigint: return 99 + 2**200 - elif dtype == ak.bool: + elif dtype == ak.bool_: return False elif dtype == ak.float64: return -3.14 @@ -125,7 +125,7 @@ def build_repeat_filter_data(dtype): elif dtype == ak.bigint: a = [2**200 + i for i in [1, 2, 1, 1, 3, 3, 5, 4, 6, 2]] b = [2**200 + i for i in [10, 11, 11, 12, 13, 10, 4, 6, 1, 12]] - elif dtype == ak.bool: + elif dtype == ak.bool_: a = [True, False, True, False, False] b = [False, False, True, False, True] elif dtype == ak.float64: @@ -149,7 +149,7 @@ def get_setops_segments(dtype): b = [2**200 + x for x in b] c = [2**200 + x for x in c] d = [2**200 + x for x in d] - elif dtype == ak.bool: + elif dtype == ak.bool_: a = [True, False, True, True] b = [False, False, False] c = [True, True] @@ -615,7 +615,7 @@ def get_filter(dtype): return 3 + 2**200 elif dtype == ak.float64: return 3.14 - elif dtype == ak.bool: + elif dtype == ak.bool_: return False elif dtype == ak.str_: return "a" @@ -628,7 +628,7 @@ def get_filter_list(dtype): return [1 + 2**200, 3 + 2**200] elif dtype == ak.float64: return [3.14, 1.01] - elif dtype == ak.bool: + elif dtype == ak.bool_: return [False] elif dtype == ak.str_: return ["a", "abc"] diff --git a/PROTO_tests/tests/series_test.py b/PROTO_tests/tests/series_test.py index 3976762175..74f970a2bb 100644 --- a/PROTO_tests/tests/series_test.py +++ b/PROTO_tests/tests/series_test.py @@ -6,10 +6,10 @@ import arkouda as ak from arkouda.series import Series -DTYPES = [ak.int64, ak.uint64, ak.bool, ak.float64, ak.bigint, ak.str_] -NO_STRING = [ak.int64, ak.uint64, ak.bool, ak.float64, ak.bigint] +DTYPES = [ak.int64, ak.uint64, ak.bool_, ak.float64, ak.bigint, ak.str_] +NO_STRING = [ak.int64, ak.uint64, ak.bool_, ak.float64, ak.bigint] NUMERICAL_TYPES = [ak.int64, ak.uint64, ak.float64, ak.bigint] -INTEGRAL_TYPES = [ak.int64, ak.uint64, ak.bool, ak.bigint] +INTEGRAL_TYPES = [ak.int64, ak.uint64, ak.bool_, ak.bigint] class TestSeries: @@ -92,7 +92,7 @@ def test_add(self, dtype): ) ) assert (added.index == ak.arange(size)).all() - if dtype != ak.bool: + if dtype != ak.bool_: assert all(i in added.values.to_list() for i in range(size)) else: # we have exactly one False diff --git a/PROTO_tests/tests/setops_test.py b/PROTO_tests/tests/setops_test.py index 8346ab4c1f..e78469e470 100644 --- a/PROTO_tests/tests/setops_test.py +++ b/PROTO_tests/tests/setops_test.py @@ -6,7 +6,7 @@ OPS = ["in1d", "intersect1d", "union1d", "setxor1d", "setdiff1d"] INTEGRAL_TYPES = [ak.int64, ak.uint64, ak.bigint] -NUMERIC_TYPES = [ak.int64, ak.uint64, ak.bigint, ak.bool] +NUMERIC_TYPES = [ak.int64, ak.uint64, ak.bigint, ak.bool_] class TestSetOps: @@ -38,7 +38,7 @@ def make_np_arrays_small(dtype): elif dtype == ak.bigint: a = np.array([-1, 0, 1, 3]).astype(ak.uint64) + 2**200 b = np.array([-1, 2, 2, 3]).astype(ak.uint64) + 2**200 - elif dtype == ak.bool: + elif dtype == ak.bool_: a = np.array([True, False, False, True]).astype(dtype) b = np.array([True, True, False, False]).astype(dtype) else: @@ -53,7 +53,7 @@ def make_np_arrays_cross_type(dtype1, dtype2): elif dtype1 == ak.bigint: a = np.array([-1, -3, 0, 1, 2, 3]).astype(ak.uint64) + 2**200 c = np.array([-1, 0, 0, 7, 8, 3]).astype(ak.uint64) + 2**200 - elif dtype1 == ak.bool: + elif dtype1 == ak.bool_: a = np.array([True, False, False, True, True]) c = np.array([True, True, False, False, True]) else: @@ -65,7 +65,7 @@ def make_np_arrays_cross_type(dtype1, dtype2): elif dtype2 == ak.bigint: b = np.array([-1, -11, 0, 4, 5, 3]).astype(ak.uint64) + 2**200 d = np.array([-1, -4, 0, 7, 8, 3]).astype(ak.uint64) + 2**200 - elif dtype2 == ak.bool: + elif dtype2 == ak.bool_: b = np.array([True, True, False, False, True]) d = np.array([True, True, False, False, True]) else: @@ -99,10 +99,10 @@ def test_setop_error_handling(self, size, op): func = getattr(ak, op) # # bool is not supported by argsortMsg (only impacts single array case) - a, b = self.make_np_arrays(size, ak.bool) + a, b = self.make_np_arrays(size, ak.bool_) if op in ["in1d", "setdiff1d"]: with pytest.raises(RuntimeError): - func(ak.array(a, dtype=ak.bool), ak.array(b, dtype=ak.bool)) + func(ak.array(a, dtype=ak.bool_), ak.array(b, dtype=ak.bool_)) @pytest.mark.parametrize("size", pytest.prob_size) @pytest.mark.parametrize("op", OPS) diff --git a/PROTO_tests/tests/sort_test.py b/PROTO_tests/tests/sort_test.py index 6679993105..b99ee1fd48 100644 --- a/PROTO_tests/tests/sort_test.py +++ b/PROTO_tests/tests/sort_test.py @@ -69,7 +69,7 @@ def test_bit_boundary(self, algo): @pytest.mark.parametrize("algo", SortingAlgorithm) def test_error_handling(self, algo): # Test RuntimeError from bool NotImplementedError - ak_bools = ak.randint(0, 1, 1000, dtype=ak.bool) + ak_bools = ak.randint(0, 1, 1000, dtype=ak.bool_) bools = ak.randint(0, 1, 1000, dtype=bool) for arr in ak_bools, bools: diff --git a/PROTO_tests/tests/string_test.py b/PROTO_tests/tests/string_test.py index 1a34d4276f..be3893a3a8 100644 --- a/PROTO_tests/tests/string_test.py +++ b/PROTO_tests/tests/string_test.py @@ -168,7 +168,7 @@ def test_pdarray_index(self, size): inds = ak.arange(0, strings.size, 10) assert self.compare_strings(strings[inds].to_ndarray(), test_strings[inds.to_ndarray()]) assert self.compare_strings(cat[inds].to_ndarray(), test_strings[inds.to_ndarray()]) - logical = ak.zeros(strings.size, dtype=ak.bool) + logical = ak.zeros(strings.size, dtype=ak.bool_) logical[inds] = True assert self.compare_strings(strings[logical].to_ndarray(), test_strings[logical.to_ndarray()]) # Indexing with a one-element pdarray (int) should return Strings array, not string scalar @@ -178,7 +178,7 @@ def test_pdarray_index(self, size): assert isinstance(result, ak.Strings) and (result.size == 1) assert result[0] == strings[i] # Logical indexing with all-False array should return empty Strings array - logicalSingleton = ak.zeros(strings.size, dtype=ak.bool) + logicalSingleton = ak.zeros(strings.size, dtype=ak.bool_) result = strings[logicalSingleton] assert isinstance(result, ak.Strings) and (result.size == 0) # Logical indexing with a single True should return one-element Strings array, not string scalar diff --git a/PROTO_tests/tests/symbol_table_test.py b/PROTO_tests/tests/symbol_table_test.py index 98f89f2a36..95241f6329 100644 --- a/PROTO_tests/tests/symbol_table_test.py +++ b/PROTO_tests/tests/symbol_table_test.py @@ -6,7 +6,7 @@ N = 100 UNIQUE = N // 4 -DTYPES = [ak.int64, ak.uint64, ak.bool, ak.float64, ak.bigint, ak.str_] +DTYPES = [ak.int64, ak.uint64, ak.bool_, ak.float64, ak.bigint, ak.str_] def clean_registry(): @@ -30,8 +30,8 @@ def make_pdarray(dtype, size): return ak.arange(size) elif dtype == ak.bigint: return ak.arange(size) + 2**200 - elif dtype == ak.bool: - return ak.randint(0, 2, size, dtype=ak.bool) + elif dtype == ak.bool_: + return ak.randint(0, 2, size, dtype=ak.bool_) elif dtype == ak.float64: return ak.linspace(-2.5, 2.5, size) elif dtype == ak.str_: diff --git a/PROTO_tests/tests/where_test.py b/PROTO_tests/tests/where_test.py index c313d06456..89dbaec979 100644 --- a/PROTO_tests/tests/where_test.py +++ b/PROTO_tests/tests/where_test.py @@ -146,7 +146,7 @@ def test_multiple_where_clauses(self): def test_dtypes(self): cond = (ak.arange(10) % 2) == 0 - for dt in (ak.int64, ak.uint64, ak.float64, ak.bool): + for dt in (ak.int64, ak.uint64, ak.float64, ak.bool_): a = ak.ones(10, dtype=dt) b = ak.ones(10, dtype=dt) assert ak.where(cond, a, b).to_list() == a.to_list() diff --git a/arkouda/array_api/searching_functions.py b/arkouda/array_api/searching_functions.py index d7122cbd41..4270719f22 100644 --- a/arkouda/array_api/searching_functions.py +++ b/arkouda/array_api/searching_functions.py @@ -139,7 +139,7 @@ def where(condition: Array, x1: Array, x2: Array, /) -> Array: cmd=f"efunc3vv{broadcasted[0].ndim}D", args={ "func": "where", - "condition": akcast(broadcasted[0]._array, ak.dtypes.bool), + "condition": akcast(broadcasted[0]._array, ak.dtypes.bool_), "a": broadcasted[1]._array, "b": broadcasted[2]._array, }, diff --git a/arkouda/categorical.py b/arkouda/categorical.py index 3affe91c63..5cea888a4f 100644 --- a/arkouda/categorical.py +++ b/arkouda/categorical.py @@ -19,7 +19,7 @@ from typeguard import typechecked from arkouda.client import generic_msg -from arkouda.dtypes import bool as akbool +from arkouda.dtypes import bool_ as akbool from arkouda.dtypes import int64 as akint64 from arkouda.dtypes import int_scalars, npstr, resolve_scalar_dtype, str_, str_scalars from arkouda.groupbyclass import GroupBy, unique diff --git a/arkouda/dataframe.py b/arkouda/dataframe.py index 5539d037b1..494de5e6d4 100644 --- a/arkouda/dataframe.py +++ b/arkouda/dataframe.py @@ -18,7 +18,8 @@ from arkouda.client import generic_msg, maxTransferBytes from arkouda.client_dtypes import BitVector, Fields, IPv4 from arkouda.dtypes import BigInt -from arkouda.dtypes import bool as akbool + +from arkouda.dtypes import bool_ as akbool from arkouda.dtypes import float64 as akfloat64 from arkouda.dtypes import int64 as akint64 from arkouda.dtypes import uint64 as akuint64 diff --git a/arkouda/dtypes.py b/arkouda/dtypes.py index 53729f54fb..ad1f564eac 100644 --- a/arkouda/dtypes.py +++ b/arkouda/dtypes.py @@ -25,7 +25,7 @@ "float64", "complex64", "complex128", - "bool", + "bool_", "str_", "bigint", "intTypes", @@ -129,7 +129,7 @@ def type(self, x): float64 = np.dtype(np.float64) complex64 = np.dtype(np.complex64) complex128 = np.dtype(np.complex128) -bool = np.dtype(bool) +bool_ = np.dtype(bool) str_ = np.dtype(np.str_) bigint = BigInt() npstr = np.dtype(str) @@ -242,12 +242,12 @@ def __repr__(self) -> str: # missing full support for: float32, int32, int16, int8, uint32, uint16, complex64, complex128 # ARKOUDA_SUPPORTED_DTYPES = frozenset([member.value for _, member in DType.__members__.items()]) ARKOUDA_SUPPORTED_DTYPES = frozenset( - ["bool", "float", "float64", "int", "int64", "uint", "uint64", "uint8", "bigint", "str"] + ["bool_", "float", "float64", "int", "int64", "uint", "uint64", "uint8", "bigint", "str"] ) DTypes = frozenset([member.value for _, member in DType.__members__.items()]) -DTypeObjects = frozenset([bool, float, float64, int, int64, str, str_, uint8, uint64]) -NumericDTypes = frozenset(["bool", "float", "float64", "int", "int64", "uint64", "bigint"]) +DTypeObjects = frozenset([bool_, float, float64, int, int64, str, str_, uint8, uint64]) +NumericDTypes = frozenset(["bool_", "bool", "float", "float64", "int", "int64", "uint64", "bigint"]) SeriesDTypes = { "string": np.str_, "": np.str_, @@ -256,12 +256,12 @@ def __repr__(self) -> str: "": np.int64, "float64": np.float64, "": np.float64, - "bool": bool, - "": bool, + "bool": np.bool_, + "": np.bool_, "datetime64[ns]": np.int64, "timedelta64[ns]": np.int64, } -ScalarDTypes = frozenset(["bool", "float64", "int64"]) +ScalarDTypes = frozenset(["bool_", "float64", "int64"]) def isSupportedInt(num): diff --git a/arkouda/index.py b/arkouda/index.py index 028ba64d1f..d4887c362c 100644 --- a/arkouda/index.py +++ b/arkouda/index.py @@ -10,7 +10,7 @@ from typeguard import typechecked from arkouda import Categorical, Strings -from arkouda.dtypes import bool as akbool +from arkouda.dtypes import bool_ as akbool from arkouda.dtypes import float64 as akfloat64 from arkouda.dtypes import int64 as akint64 from arkouda.groupbyclass import GroupBy, unique diff --git a/arkouda/numeric.py b/arkouda/numeric.py index b402902c2d..2200907096 100644 --- a/arkouda/numeric.py +++ b/arkouda/numeric.py @@ -131,10 +131,10 @@ def cast( >>> ak.cast(ak.arange(0,5), dt=ak.float64).dtype dtype('float64') - >>> ak.cast(ak.arange(0,5), dt=ak.bool) + >>> ak.cast(ak.arange(0,5), dt=ak.bool_) array([False, True, True, True, True]) - >>> ak.cast(ak.linspace(0,4,5), dt=ak.bool) + >>> ak.cast(ak.linspace(0,4,5), dt=ak.bool_) array([False, True, True, True, True]) """ from arkouda.categorical import Categorical # type: ignore @@ -740,7 +740,7 @@ def cumsum(pda: pdarray) -> pdarray: array([3.1598310770203937, 5.4110385860243131, 9.1622479306453748, 12.710615785506533, 13.945880905466208]) - >>> ak.cumsum(ak.randint(0, 1, 5, dtype=ak.bool)) + >>> ak.cumsum(ak.randint(0, 1, 5, dtype=ak.bool_)) array([0, 1, 1, 2, 3]) """ repMsg = generic_msg( diff --git a/arkouda/numpy/_numeric.py b/arkouda/numpy/_numeric.py index c4315d8d5e..2be40cc316 100644 --- a/arkouda/numpy/_numeric.py +++ b/arkouda/numpy/_numeric.py @@ -4,7 +4,12 @@ from arkouda.client import generic_msg from arkouda.pdarrayclass import create_pdarray, pdarray -from arkouda.dtypes import int64 as ak_int64, float64 as ak_float64, bool as ak_bool, uint64 as ak_uint64 +from arkouda.dtypes import ( + int64 as ak_int64, + float64 as ak_float64, + bool_ as ak_bool, + uint64 as ak_uint64, +) NUMERIC_TYPES = [ak_int64, ak_float64, ak_bool, ak_uint64] diff --git a/arkouda/pdarrayclass.py b/arkouda/pdarrayclass.py index af1bbf1dfe..060056636e 100644 --- a/arkouda/pdarrayclass.py +++ b/arkouda/pdarrayclass.py @@ -11,8 +11,7 @@ from arkouda.client import generic_msg from arkouda.dtypes import NUMBER_FORMAT_STRINGS, DTypes, bigint -from arkouda.dtypes import bool as akbool -from arkouda.dtypes import bool as npbool +from arkouda.dtypes import bool_ as akbool from arkouda.dtypes import dtype, get_byteorder from arkouda.dtypes import float64 as akfloat64 from arkouda.dtypes import get_server_byteorder @@ -112,7 +111,7 @@ def unescape(s): return int(value[1:-1]) else: return int(value) - if mydtype == npbool: + if mydtype == akbool: if value == "True": return mydtype.type(True) elif value == "False": diff --git a/arkouda/pdarraycreation.py b/arkouda/pdarraycreation.py index b0353e1b8d..52179eb516 100644 --- a/arkouda/pdarraycreation.py +++ b/arkouda/pdarraycreation.py @@ -426,7 +426,7 @@ def zeros( >>> ak.zeros(5, dtype=ak.float64) array([0, 0, 0, 0, 0]) - >>> ak.zeros(5, dtype=ak.bool) + >>> ak.zeros(5, dtype=ak.bool_) array([False, False, False, False, False]) """ if not np.isscalar(size): @@ -482,7 +482,7 @@ def ones( >>> ak.ones(5, dtype=ak.float64) array([1, 1, 1, 1, 1]) - >>> ak.ones(5, dtype=ak.bool) + >>> ak.ones(5, dtype=ak.bool_) array([True, True, True, True, True]) """ if not np.isscalar(size): @@ -544,7 +544,7 @@ def full( >>> ak.full(5, 9, dtype=ak.float64) array([9, 9, 9, 9, 9]) - >>> ak.full(5, 5, dtype=ak.bool) + >>> ak.full(5, 5, dtype=ak.bool_) array([True, True, True, True, True]) """ if not np.isscalar(size): @@ -651,7 +651,7 @@ def zeros_like(pda: pdarray) -> pdarray: >>> ak.zeros_like(zeros) array([0, 0, 0, 0, 0]) - >>> zeros = ak.zeros(5, dtype=ak.bool) + >>> zeros = ak.zeros(5, dtype=ak.bool_) >>> ak.zeros_like(zeros) array([False, False, False, False, False]) """ @@ -698,7 +698,7 @@ def ones_like(pda: pdarray) -> pdarray: >>> ak.ones_like(ones) array([1, 1, 1, 1, 1]) - >>> ones = ak.ones(5, dtype=ak.bool) + >>> ones = ak.ones(5, dtype=ak.bool_) >>> ak.ones_like(ones) array([True, True, True, True, True]) """ @@ -747,7 +747,7 @@ def full_like(pda: pdarray, fill_value: numeric_scalars) -> pdarray: >>> ak.full_like(full) array([9, 9, 9, 9, 9]) - >>> full = ak.full(5, 5, dtype=ak.bool) + >>> full = ak.full(5, 5, dtype=ak.bool_) >>> ak.full_like(full) array([True, True, True, True, True]) """ @@ -971,7 +971,7 @@ def randint( >>> ak.randint(0, 1, 3, dtype=ak.float64) array([0.92176432277231968, 0.083130710959903542, 0.68894208386667544]) - >>> ak.randint(0, 1, 5, dtype=ak.bool) + >>> ak.randint(0, 1, 5, dtype=ak.bool_) array([True, False, True, True, True]) >>> ak.randint(1, 5, 10, seed=2) diff --git a/arkouda/pdarraysetops.py b/arkouda/pdarraysetops.py index ffe6e4c755..d7bbb2f547 100644 --- a/arkouda/pdarraysetops.py +++ b/arkouda/pdarraysetops.py @@ -8,7 +8,7 @@ from arkouda.client import generic_msg from arkouda.client_dtypes import BitVector from arkouda.dtypes import bigint -from arkouda.dtypes import bool as akbool +from arkouda.dtypes import bool_ as akbool from arkouda.dtypes import int64 as akint64 from arkouda.dtypes import uint64 as akuint64 from arkouda.groupbyclass import GroupBy, groupable, groupable_element_type, unique @@ -84,16 +84,15 @@ def _in1d_single( array([False, True]) """ from arkouda.categorical import Categorical as Categorical_ - from arkouda.dtypes import bool as ak_bool if isinstance(pda1, pdarray) or isinstance(pda1, Strings) or isinstance(pda1, Categorical_): # While isinstance(thing, type) can be called on a tuple of types, # this causes an issue with mypy for unknown reasons. if pda1.size == 0: - return zeros(0, dtype=ak_bool) + return zeros(0, dtype=akbool) if isinstance(pda2, pdarray) or isinstance(pda2, Strings) or isinstance(pda2, Categorical_): if pda2.size == 0: - return zeros(pda1.size, dtype=ak_bool) + return zeros(pda1.size, dtype=akbool) if hasattr(pda1, "categories"): x = cast(Categorical_, pda1).in1d(pda2) return x if not invert else ~x diff --git a/arkouda/random/_generator.py b/arkouda/random/_generator.py index b3ebb69483..a4a90d643a 100644 --- a/arkouda/random/_generator.py +++ b/arkouda/random/_generator.py @@ -2,7 +2,7 @@ from arkouda.client import generic_msg from arkouda.dtypes import _val_isinstance_of_union -from arkouda.dtypes import bool as akbool +from arkouda.dtypes import bool_ as akbool from arkouda.dtypes import dtype as to_numpy_dtype from arkouda.dtypes import float64 as akfloat64 from arkouda.dtypes import float_scalars diff --git a/arkouda/random/_legacy.py b/arkouda/random/_legacy.py index 9ac30113cd..dfde8ace59 100644 --- a/arkouda/random/_legacy.py +++ b/arkouda/random/_legacy.py @@ -65,7 +65,7 @@ def randint( >>> ak.randint(0, 1, 3, dtype=ak.float64) array([0.92176432277231968, 0.083130710959903542, 0.68894208386667544]) - >>> ak.randint(0, 1, 5, dtype=ak.bool) + >>> ak.randint(0, 1, 5, dtype=ak.bool_) array([True, False, True, True, True]) >>> ak.randint(1, 5, 10, seed=2) diff --git a/arkouda/segarray.py b/arkouda/segarray.py index f57d138df9..bf8e3c832f 100644 --- a/arkouda/segarray.py +++ b/arkouda/segarray.py @@ -9,7 +9,7 @@ import numpy as np from arkouda.client import generic_msg -from arkouda.dtypes import bool as akbool +from arkouda.dtypes import bool_ as akbool from arkouda.dtypes import int64 as akint64 from arkouda.dtypes import int_scalars, isSupportedInt, str_ from arkouda.dtypes import uint64 as akuint64 diff --git a/benchmarks/sort-cases.py b/benchmarks/sort-cases.py index ae4f53e650..efdd874bba 100755 --- a/benchmarks/sort-cases.py +++ b/benchmarks/sort-cases.py @@ -14,7 +14,7 @@ def is_cosorted(data): def helper(x, right): return (x[1:] > x[:-1]) | ((x[1:] == x[:-1]) & right) - right = ak.ones(data[0].size - 1, dtype=ak.bool) + right = ak.ones(data[0].size - 1, dtype=ak.bool_) for x in reversed(data): right = helper(x, right) return right.all() diff --git a/pydoc/usage/indexing.rst b/pydoc/usage/indexing.rst index e37d24c873..1590d40a31 100644 --- a/pydoc/usage/indexing.rst +++ b/pydoc/usage/indexing.rst @@ -66,7 +66,7 @@ Logical indexing is a powerful construct from NumPy (and Matlab). In logical ind .. code-block:: python >>> A = ak.arange(0, 10, 1) - >>> inds = ak.zeros(10, dtype=ak.bool) + >>> inds = ak.zeros(10, dtype=ak.bool_) >>> inds[2] = True >>> inds[5] = True >>> A[inds] # boolean-compression indexing yield values where inds is True diff --git a/tests/array_api/util_functions.py b/tests/array_api/util_functions.py index 9bca1e0255..abe4b997d8 100644 --- a/tests/array_api/util_functions.py +++ b/tests/array_api/util_functions.py @@ -16,14 +16,14 @@ def randArr(shape): class UtilFunctions(ArkoudaTest): def test_all(self): - a = xp.ones((10, 10), dtype=ak.bool) + a = xp.ones((10, 10), dtype=ak.bool_) self.assertTrue(xp.all(a)) a[3, 4] = False self.assertFalse(xp.all(a)) def test_any(self): - a = xp.zeros((10, 10), dtype=ak.bool) + a = xp.zeros((10, 10), dtype=ak.bool_) self.assertFalse(xp.any(a)) a[3, 4] = True diff --git a/tests/deprecated/ak_test.py b/tests/deprecated/ak_test.py index 61f0341f0d..891a003a78 100755 --- a/tests/deprecated/ak_test.py +++ b/tests/deprecated/ak_test.py @@ -35,7 +35,7 @@ print(b, b.dtype) print(a, a.dtype) -a = ak.randint(0, 2, 10, dtype=ak.bool) +a = ak.randint(0, 2, 10, dtype=ak.bool_) a[1] = True a[2] = True print(a) @@ -50,14 +50,14 @@ a[iv] = 10.0 print(a) -a = ak.ones(10, dtype=ak.bool) +a = ak.ones(10, dtype=ak.bool_) iv = ak.arange(0, 10, 1)[::2] a[iv] = False print(a) -a = ak.ones(10, dtype=ak.bool) +a = ak.ones(10, dtype=ak.bool_) iv = ak.arange(0, 5, 1) -b = ak.zeros(iv.size, dtype=ak.bool) +b = ak.zeros(iv.size, dtype=ak.bool_) a[iv] = b print(a) @@ -103,7 +103,7 @@ print(h) ak.verbose = False -a = ak.randint(0, 2, 50, dtype=ak.bool) +a = ak.randint(0, 2, 50, dtype=ak.bool_) print(a) print(a.sum()) @@ -143,7 +143,7 @@ b = np.array(list(a)) print(a, a.dtype, b, b.dtype) -a = ak.ones(10, dtype=ak.bool) +a = ak.ones(10, dtype=ak.bool_) b = np.array(list(a)) print(a, a.dtype, b, b.dtype) @@ -273,16 +273,16 @@ ak.verbose = False -a = ak.ones(10, dtype=ak.bool) +a = ak.ones(10, dtype=ak.bool_) print(a[1]) ak.verbose = False -a = ak.zeros(10, dtype=ak.bool) +a = ak.zeros(10, dtype=ak.bool_) print(a[1]) ak.verbose = False -a = ak.ones(10, dtype=ak.bool) +a = ak.ones(10, dtype=ak.bool_) a[4] = False a[1] = False print(a) @@ -319,13 +319,13 @@ a.fill(math.e) print(ak.log(a)) -type(bool), type(np.bool), type(ak.bool), type(True) +type(bool), type(np.bool_), type(ak.bool_), type(True) ak.verbose = False a = ak.linspace(0, 9, 10) print(a, ak.any(a), ak.all(a), ak.all(ak.ones(10, dtype=ak.float64))) b = a < 5 -print(b, ak.any(b), ak.all(b), ak.all(ak.ones(10, dtype=ak.bool))) +print(b, ak.any(b), ak.all(b), ak.all(ak.ones(10, dtype=ak.bool_))) c = ak.arange(0, 10, 1) print(c, ak.any(c), ak.all(c), ak.all(ak.ones(10, dtype=ak.int64))) print(a.any(), a.all(), b.any(), b.all()) diff --git a/tests/deprecated/dataframe_test.py b/tests/deprecated/dataframe_test.py index 8366ca4b4d..320da13d49 100644 --- a/tests/deprecated/dataframe_test.py +++ b/tests/deprecated/dataframe_test.py @@ -670,7 +670,7 @@ def test_gb_size_as_index_cases(self): assert_series_equal(pd6, ak6.to_pandas()) def test_memory_usage(self): - dtypes = [ak.int64, ak.float64, ak.bool] + dtypes = [ak.int64, ak.float64, ak.bool_] data = dict([(str(t), ak.ones(5000, dtype=ak.int64).astype(t)) for t in dtypes]) df = ak.DataFrame(data) ak_memory_usage = df.memory_usage() diff --git a/tests/deprecated/dtypes_tests.py b/tests/deprecated/dtypes_tests.py index 14920f5f33..92413ff8d3 100644 --- a/tests/deprecated/dtypes_tests.py +++ b/tests/deprecated/dtypes_tests.py @@ -136,7 +136,7 @@ def test_nbytes(self): ak.dtypes.uint64, ak.dtypes.int64, ak.dtypes.float64, - ak.dtypes.bool, + ak.dtypes.bool_, ] for dt in dtype_list: @@ -226,14 +226,25 @@ def test_DtypeEnum(self): ) self.assertEqual( frozenset( - {"bool", "float", "float64", "int", "int64", "uint", "uint64", "uint8", "bigint", "str"} + { + "bool_", + "float", + "float64", + "int", + "int64", + "uint", + "uint64", + "uint8", + "bigint", + "str", + } ), ak.ARKOUDA_SUPPORTED_DTYPES, ) def test_NumericDTypes(self): self.assertEqual( - frozenset(["bool", "float", "float64", "int", "int64", "uint64", "bigint"]), + frozenset(["bool", "bool_", "float", "float64", "int", "int64", "uint64", "bigint"]), dtypes.NumericDTypes, ) diff --git a/tests/deprecated/numeric_test.py b/tests/deprecated/numeric_test.py index d79f788c05..c5790ef10c 100644 --- a/tests/deprecated/numeric_test.py +++ b/tests/deprecated/numeric_test.py @@ -15,7 +15,7 @@ class NumericTest(ArkoudaTest): def testSeededRNG(self): N = 100 seed = 8675309 - numericdtypes = [ak.int64, ak.float64, ak.bool, ak.uint64] + numericdtypes = [ak.int64, ak.float64, ak.bool_, ak.uint64] for dt in numericdtypes: # Make sure unseeded runs differ a = ak.randint(0, 2**32, N, dtype=dt) @@ -59,11 +59,11 @@ def testCast(self): arrays = { ak.int64: ak.randint(-(2**48), 2**48, N), ak.float64: ak.randint(0, 1, N, dtype=ak.float64), - ak.bool: ak.randint(0, 2, N, dtype=ak.bool), + ak.bool_: ak.randint(0, 2, N, dtype=ak.bool_), } roundtripable = set( ( - (ak.bool, ak.bool), + (ak.bool_, ak.bool_), (ak.int64, ak.int64), (ak.int64, ak.float64), (ak.int64, npstr), @@ -96,7 +96,7 @@ def testCast(self): self.assertEqual(ak.cast(ak.arange(0, 5), dt=ak.float64).dtype, ak.float64) self.assertListEqual( [False, True, True, True, True], - ak.cast(ak.linspace(0, 4, 5), dt=ak.bool).to_list(), + ak.cast(ak.linspace(0, 4, 5), dt=ak.bool_).to_list(), ) def testStrCastErrors(self): @@ -127,7 +127,7 @@ def testStrCastErrors(self): (ak.int64, intstr, intans), (ak.uint64, uintstr, uintans), (ak.float64, floatstr, floatans), - (ak.bool, boolstr, boolans), + (ak.bool_, boolstr, boolans), ]: with self.assertRaises(RuntimeError): ak.cast(arg, dt, errors=ak.ErrorMode.strict) diff --git a/tests/io_test.py b/tests/io_test.py index f8ad846874..023d790231 100644 --- a/tests/io_test.py +++ b/tests/io_test.py @@ -41,8 +41,8 @@ def setUp(self): self.float_ndarray.sort() self.float_pdarray_dupe = ak.array(np.random.uniform(-100, 100, 1000)) - self.bool_pdarray = ak.randint(0, 1, 1000, dtype=ak.bool) - self.bool_pdarray_dupe = ak.randint(0, 1, 1000, dtype=ak.bool) + self.bool_pdarray = ak.randint(0, 1, 1000, dtype=ak.bool_) + self.bool_pdarray_dupe = ak.randint(0, 1, 1000, dtype=ak.bool_) self.dict_columns = { "int_tens_pdarray": self.int_tens_pdarray, @@ -916,7 +916,7 @@ def test_segarray_hdf(self): self.assertListEqual(segarr.values.to_list(), seg2.values.to_list()) # bool test - dtype = ak.dtypes.bool + dtype = ak.dtypes.bool_ akflat = ak.array(flat, dtype) segarr = ak.SegArray(segments, akflat) @@ -1039,7 +1039,7 @@ def test_hdf_overwrite_pdarray(self): data = ak.read_hdf(f"{tmp_dirname}/pda_test_*").popitem()[1] self.assertListEqual(data.to_list(), b.to_list()) - b = ak.arange(1000, dtype=ak.bool) + b = ak.arange(1000, dtype=ak.bool_) b.update_hdf(f"{tmp_dirname}/pda_test") data = ak.read_hdf(f"{tmp_dirname}/pda_test_*").popitem()[1] self.assertListEqual(data.to_list(), b.to_list()) @@ -1245,7 +1245,7 @@ def test_snapshot(self): "int_col": ak.arange(10), "uint_col": ak.array([i + 2**63 for i in range(10)], dtype=ak.uint64), "float_col": ak.linspace(-3.5, 3.5, 10), - "bool_col": ak.randint(0, 2, 10, dtype=ak.bool), + "bool_col": ak.randint(0, 2, 10, dtype=ak.bool_), "bigint_col": ak.array([i + 2**200 for i in range(10)], dtype=ak.bigint), "segarr_col": ak.SegArray(ak.arange(0, 20, 2), ak.randint(0, 3, 20)), "str_col": ak.random_strings_uniform(0, 3, 10), diff --git a/tests/operator_tests.py b/tests/operator_tests.py index 6ef7fcb3c0..8ec480bc12 100644 --- a/tests/operator_tests.py +++ b/tests/operator_tests.py @@ -460,7 +460,7 @@ def test_shift_maxbits_binop(self): np_uint = np.array([maxbits, maxbits, maxbits, maxbits], dtype=np.uint64) ak_int = ak.array([maxbits, maxbits, maxbits, maxbits], dtype=ak.int64) np_int = np.array([maxbits, maxbits, maxbits, maxbits], dtype=np.int64) - ak_bool = ak.array([True, True, False, False], dtype=ak.bool) + ak_bool = ak.array([True, True, False, False], dtype=ak.bool_) np_bool = np.array([True, True, False, False], dtype=bool) # Shifting value arrays @@ -468,7 +468,7 @@ def test_shift_maxbits_binop(self): np_uint_array = np.array([62, 63, 64, 65], dtype=np.uint64) ak_int_array = ak.array([62, 63, 64, 65], dtype=ak.int64) np_int_array = np.array([62, 63, 64, 65], dtype=np.int64) - ak_bool_array = ak.array([True, False, True, False], dtype=ak.bool) + ak_bool_array = ak.array([True, False, True, False], dtype=ak.bool_) np_bool_array = np.array([True, False, True, False], dtype=bool) # Binopvs case @@ -900,7 +900,7 @@ def testErrorHandling(self): # Test ak,histogram against unsupported dtype # with self.assertRaises(ValueError) as cm: - # ak.histogram((ak.randint(0, 1, 100, dtype=ak.bool))) + # ak.histogram((ak.randint(0, 1, 100, dtype=ak.bool_))) with self.assertRaises(TypeError): ak.ones(100).any([0]) diff --git a/tests/parquet_test.py b/tests/parquet_test.py index e78c5e9098..7779edb494 100644 --- a/tests/parquet_test.py +++ b/tests/parquet_test.py @@ -34,7 +34,7 @@ def test_parquet(self): elif dtype == "uint64": ak_arr = ak.randint(0, 2**32, SIZE, dtype=ak.uint64) elif dtype == "bool": - ak_arr = ak.randint(0, 1, SIZE, dtype=ak.bool) + ak_arr = ak.randint(0, 1, SIZE, dtype=ak.bool_) elif dtype == "float64": ak_arr = ak.randint(0, 2**32, SIZE, dtype=ak.float64) elif dtype == "str": @@ -60,7 +60,7 @@ def test_multi_file(self): elif dtype == "uint64": elems = ak.randint(0, 2**32, adjusted_size, dtype=ak.uint64) elif dtype == "bool": - elems = ak.randint(0, 1, adjusted_size, dtype=ak.bool) + elems = ak.randint(0, 1, adjusted_size, dtype=ak.bool_) elif dtype == "float64": elems = ak.randint(0, 2**32, adjusted_size, dtype=ak.float64) elif dtype == "str": @@ -111,7 +111,7 @@ def test_get_datasets(self): elif dtype == "uint64": ak_arr = ak.randint(0, 2**32, 10, dtype=ak.uint64) elif dtype == "bool": - ak_arr = ak.randint(0, 1, 10, dtype=ak.bool) + ak_arr = ak.randint(0, 1, 10, dtype=ak.bool_) elif dtype == "float64": ak_arr = ak.randint(0, 2**32, SIZE, dtype=ak.float64) elif dtype == "str": @@ -129,7 +129,7 @@ def test_append(self): base_dset = ak.randint(0, 2**32, append_size) ak_dict = {} ak_dict["uint-dset"] = ak.randint(0, 2**32, append_size, dtype=ak.uint64) - ak_dict["bool-dset"] = ak.randint(0, 1, append_size, dtype=ak.bool) + ak_dict["bool-dset"] = ak.randint(0, 1, append_size, dtype=ak.bool_) ak_dict["float-dset"] = ak.randint(0, 2**32, append_size, dtype=ak.float64) ak_dict["int-dset"] = ak.randint(0, 2**32, append_size) ak_dict["str-dset"] = ak.random_strings_uniform(1, 10, append_size) @@ -171,7 +171,7 @@ def test_append_empty(self): elif dtype == "uint64": ak_arr = ak.randint(0, 2**32, SIZE, dtype=ak.uint64) elif dtype == "bool": - ak_arr = ak.randint(0, 1, SIZE, dtype=ak.bool) + ak_arr = ak.randint(0, 1, SIZE, dtype=ak.bool_) elif dtype == "float64": ak_arr = ak.randint(0, 2**32, SIZE, dtype=ak.float64) elif dtype == "str": @@ -196,7 +196,7 @@ def test_compression(self): # validate the list read out matches the array used to write self.assertListEqual(rd_arr.to_list(), a.to_list()) - b = ak.randint(0, 2, 150, dtype=ak.bool) + b = ak.randint(0, 2, 150, dtype=ak.bool_) for comp in COMPRESSIONS: with tempfile.TemporaryDirectory(dir=ParquetTest.par_test_base_tmp) as tmp_dirname: # write with the selected compression @@ -407,7 +407,7 @@ def test_segarray_write(self): a = [0, 1, 1] b = [0] c = [1, 0] - s = ak.SegArray(ak.array([0, len(a), len(a) + len(b)]), ak.array(a + b + c, dtype=ak.bool)) + s = ak.SegArray(ak.array([0, len(a), len(a) + len(b)]), ak.array(a + b + c, dtype=ak.bool_)) with tempfile.TemporaryDirectory(dir=ParquetTest.par_test_base_tmp) as tmp_dirname: s.to_parquet(f"{tmp_dirname}/bool_test") @@ -419,7 +419,7 @@ def test_segarray_write(self): a = [0, 1, 1] c = [1, 0] s = ak.SegArray( - ak.array([0, 0, len(a), len(a), len(a), len(a) + len(c)]), ak.array(a + c, dtype=ak.bool) + ak.array([0, 0, len(a), len(a), len(a), len(a) + len(c)]), ak.array(a + c, dtype=ak.bool_) ) with tempfile.TemporaryDirectory(dir=ParquetTest.par_test_base_tmp) as tmp_dirname: s.to_parquet(f"{tmp_dirname}/bool_test_empty") @@ -458,7 +458,7 @@ def test_multicol_write(self): "c_3": ak.arange(3, 6, dtype=ak.uint64), "c_4": ak.SegArray(ak.array([0, 5, 10]), ak.arange(15, dtype=ak.uint64)), "c_5": ak.array([False, True, False]), - "c_6": ak.SegArray(ak.array([0, 5, 10]), ak.randint(0, 1, 15, dtype=ak.bool)), + "c_6": ak.SegArray(ak.array([0, 5, 10]), ak.randint(0, 1, 15, dtype=ak.bool_)), "c_7": ak.array(np.random.uniform(0, 100, 3)), "c_8": ak.SegArray(ak.array([0, 9, 14]), ak.array(np.random.uniform(0, 100, 20))), "c_9": ak.array(["abc", "123", "xyz"]), diff --git a/tests/pdarray_creation_test.py b/tests/pdarray_creation_test.py index fdf0abfed8..d7bb310cdf 100644 --- a/tests/pdarray_creation_test.py +++ b/tests/pdarray_creation_test.py @@ -142,9 +142,9 @@ def test_arange_dtype(self): # test correct conversion to bool expected_bool = [False, True, True, True, True] - ak_arange_bool = ak.arange(0, 10, 2, dtype=ak.bool) + ak_arange_bool = ak.arange(0, 10, 2, dtype=ak.bool_) self.assertListEqual(expected_bool, ak_arange_bool.to_list()) - self.assertEqual(ak.bool, ak_arange_bool.dtype) + self.assertEqual(ak.bool_, ak_arange_bool.dtype) # test uint64 input works uint_input = ak.arange(3, dtype=ak.uint64) @@ -181,8 +181,8 @@ def test_randint(self): test_array = ak.randint(0, 1, 3, dtype=ak.float64) self.assertEqual(ak.float64, test_array.dtype) - test_array = ak.randint(0, 1, 5, dtype=ak.bool) - self.assertEqual(ak.bool, test_array.dtype) + test_array = ak.randint(0, 1, 5, dtype=ak.bool_) + self.assertEqual(ak.bool_, test_array.dtype) test_ndarray = test_array.to_ndarray() @@ -243,7 +243,7 @@ def test_randint_with_seed(self): values.to_list(), ) - values = ak.randint(1, 5, 10, dtype=ak.bool, seed=2) + values = ak.randint(1, 5, 10, dtype=ak.bool_, seed=2) self.assertListEqual( [False, True, True, True, True, False, True, True, True, True], values.to_list(), @@ -307,8 +307,8 @@ def test_zeros(self): boolZeros = ak.zeros(5, dtype=bool) self.assertEqual(bool, boolZeros.dtype) - boolZeros = ak.zeros(5, dtype=ak.bool) - self.assertEqual(ak.bool, boolZeros.dtype) + boolZeros = ak.zeros(5, dtype=ak.bool_) + self.assertEqual(ak.bool_, boolZeros.dtype) bigintZeros = ak.zeros(5, dtype=ak.bigint) self.assertEqual(ak.bigint, bigintZeros.dtype) @@ -345,8 +345,8 @@ def test_ones(self): boolOnes = ak.ones(5, dtype=bool) self.assertEqual(bool, boolOnes.dtype) - boolOnes = ak.ones(5, dtype=ak.bool) - self.assertEqual(ak.bool, boolOnes.dtype) + boolOnes = ak.ones(5, dtype=ak.bool_) + self.assertEqual(ak.bool_, boolOnes.dtype) bigintOnes = ak.ones(5, dtype=ak.bigint) self.assertEqual(ak.bigint, bigintOnes.dtype) @@ -378,10 +378,10 @@ def test_ones_like(self): self.assertEqual(ak.float64, floatOnesLike.dtype) - boolOnes = ak.ones(5, dtype=ak.bool) + boolOnes = ak.ones(5, dtype=ak.bool_) boolOnesLike = ak.ones_like(boolOnes) - self.assertEqual(ak.bool, boolOnesLike.dtype) + self.assertEqual(ak.bool_, boolOnesLike.dtype) bigintOnes = ak.ones(5, dtype=ak.bigint) bigintOnesLike = ak.ones_like(bigintOnes) @@ -413,8 +413,8 @@ def test_full(self): self.assertEqual(bool, bool_full.dtype) self.assertEqual(bool_full[0], True) - bool_full = ak.full(5, False, dtype=ak.bool) - self.assertEqual(ak.bool, bool_full.dtype) + bool_full = ak.full(5, False, dtype=ak.bool_) + self.assertEqual(ak.bool_, bool_full.dtype) self.assertEqual(bool_full[0], False) string_len_full = ak.full("5", 5) @@ -448,9 +448,9 @@ def test_full_like(self): self.assertEqual(ak.float64, float_full_like.dtype) self.assertEqual(float_full_like[0], 4) - bool_full = ak.full(5, True, dtype=ak.bool) + bool_full = ak.full(5, True, dtype=ak.bool_) bool_full_like = ak.full_like(bool_full, True) - self.assertEqual(ak.bool, bool_full_like.dtype) + self.assertEqual(ak.bool_, bool_full_like.dtype) self.assertEqual(bool_full_like[0], True) def test_zeros_like(self): @@ -465,10 +465,10 @@ def test_zeros_like(self): self.assertEqual(ak.float64, floatZerosLike.dtype) - boolZeros = ak.ones(5, dtype=ak.bool) + boolZeros = ak.ones(5, dtype=ak.bool_) boolZerosLike = ak.ones_like(boolZeros) - self.assertEqual(ak.bool, boolZerosLike.dtype) + self.assertEqual(ak.bool_, boolZerosLike.dtype) def test_linspace(self): pda = ak.linspace(0, 100, 1000) diff --git a/tests/random_test.py b/tests/random_test.py index 8d6d5c2eee..6e6d3889a8 100644 --- a/tests/random_test.py +++ b/tests/random_test.py @@ -373,8 +373,8 @@ def test_legacy_randint(self): test_array = ak.random.randint(0, 1, 3, dtype=ak.float64) self.assertEqual(ak.float64, test_array.dtype) - test_array = ak.random.randint(0, 1, 5, dtype=ak.bool) - self.assertEqual(ak.bool, test_array.dtype) + test_array = ak.random.randint(0, 1, 5, dtype=ak.bool_) + self.assertEqual(ak.bool_, test_array.dtype) test_ndarray = test_array.to_ndarray() @@ -435,7 +435,7 @@ def test_legacy_randint_with_seed(self): values.to_list(), ) - values = ak.random.randint(1, 5, 10, dtype=ak.bool, seed=2) + values = ak.random.randint(1, 5, 10, dtype=ak.bool_, seed=2) self.assertListEqual( [False, True, True, True, True, False, True, True, True, True], values.to_list(), diff --git a/tests/segarray_test.py b/tests/segarray_test.py index 0d5607c041..72862606c7 100644 --- a/tests/segarray_test.py +++ b/tests/segarray_test.py @@ -778,7 +778,7 @@ def test_equality(self): "c_2": ak.SegArray( ak.array([0, 5, 10, 10]), ak.arange(2**63, 2**63 + 15, dtype=ak.uint64) ), - "c_3": ak.SegArray(ak.array([0, 0, 5, 10]), ak.randint(0, 1, 15, dtype=ak.bool)), + "c_3": ak.SegArray(ak.array([0, 0, 5, 10]), ak.randint(0, 1, 15, dtype=ak.bool_)), "c_4": ak.SegArray( ak.array([0, 9, 14, 14]), ak.array( diff --git a/tests/sort_test.py b/tests/sort_test.py index c90931db4d..b1b270ce0d 100644 --- a/tests/sort_test.py +++ b/tests/sort_test.py @@ -57,7 +57,7 @@ def testBitBoundary(self): def testErrorHandling(self): # Test RuntimeError from bool NotImplementedError - akbools = ak.randint(0, 1, 1000, dtype=ak.bool) + akbools = ak.randint(0, 1, 1000, dtype=ak.bool_) bools = ak.randint(0, 1, 1000, dtype=bool) for algo in SortingAlgorithm: diff --git a/tests/string_test.py b/tests/string_test.py index 032bdc68e3..14801e304d 100644 --- a/tests/string_test.py +++ b/tests/string_test.py @@ -65,7 +65,7 @@ def run_test_pdarray_index(strings, test_strings, cat): inds = ak.arange(0, strings.size, 10) assert compare_strings(strings[inds].to_ndarray(), test_strings[inds.to_ndarray()]) assert compare_strings(cat[inds].to_ndarray(), test_strings[inds.to_ndarray()]) - logical = ak.zeros(strings.size, dtype=ak.bool) + logical = ak.zeros(strings.size, dtype=ak.bool_) logical[inds] = True assert compare_strings(strings[logical].to_ndarray(), test_strings[logical.to_ndarray()]) # Indexing with a one-element pdarray (int) should return Strings array, not string scalar @@ -75,7 +75,7 @@ def run_test_pdarray_index(strings, test_strings, cat): assert isinstance(result, ak.Strings) and (result.size == 1) assert result[0] == strings[i] # Logical indexing with all-False array should return empty Strings array - logicalSingleton = ak.zeros(strings.size, dtype=ak.bool) + logicalSingleton = ak.zeros(strings.size, dtype=ak.bool_) result = strings[logicalSingleton] assert isinstance(result, ak.Strings) and (result.size == 0) # Logical indexing with a single True should return one-element Strings array, not string scalar @@ -102,7 +102,7 @@ def run_test_in1d(strings, cat, base_words): for word in strings[matches].to_ndarray(): assert word in more_words # Exhaustively find all matches to make sure we didn't miss any - inds = ak.zeros(strings.size, dtype=ak.bool) + inds = ak.zeros(strings.size, dtype=ak.bool_) for word in more_words: inds |= strings == word assert (inds == matches).all() diff --git a/tests/where_test.py b/tests/where_test.py index 642d8d52c3..b27f6488ab 100644 --- a/tests/where_test.py +++ b/tests/where_test.py @@ -162,7 +162,7 @@ def test_multiple_where_clauses(self): def test_dtypes(self): cond = (ak.arange(10) % 2) == 0 - for dt in (ak.int64, ak.uint64, ak.float64, ak.bool): + for dt in (ak.int64, ak.uint64, ak.float64, ak.bool_): a = ak.ones(10, dtype=dt) b = ak.ones(10, dtype=dt) self.assertListEqual(ak.where(cond, a, b).to_list(), a.to_list())