Skip to content

Commit 8320c7f

Browse files
jbrockmendelquintusdias
authored andcommitted
remove arrmap, closes pandas-dev#27251 (pandas-dev#27530)
1 parent bcfb4cb commit 8320c7f

File tree

3 files changed

+3
-32
lines changed

3 files changed

+3
-32
lines changed

pandas/_libs/algos.pyx

-25
Original file line numberDiff line numberDiff line change
@@ -674,31 +674,6 @@ def backfill_2d_inplace(algos_t[:, :] values,
674674
val = values[j, i]
675675

676676

677-
@cython.wraparound(False)
678-
@cython.boundscheck(False)
679-
def arrmap(algos_t[:] index, object func):
680-
cdef:
681-
Py_ssize_t length = index.shape[0]
682-
Py_ssize_t i = 0
683-
ndarray[object] result = np.empty(length, dtype=np.object_)
684-
685-
from pandas._libs.lib import maybe_convert_objects
686-
687-
for i in range(length):
688-
result[i] = func(index[i])
689-
690-
return maybe_convert_objects(result)
691-
692-
693-
arrmap_float64 = arrmap["float64_t"]
694-
arrmap_float32 = arrmap["float32_t"]
695-
arrmap_object = arrmap["object"]
696-
arrmap_int64 = arrmap["int64_t"]
697-
arrmap_int32 = arrmap["int32_t"]
698-
arrmap_uint64 = arrmap["uint64_t"]
699-
arrmap_bool = arrmap["uint8_t"]
700-
701-
702677
@cython.boundscheck(False)
703678
@cython.wraparound(False)
704679
def is_monotonic(ndarray[algos_t, ndim=1] arr, bint timelike):

pandas/core/algorithms.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,9 @@ def _get_score(at):
11001100
return _get_score(q)
11011101
else:
11021102
q = np.asarray(q, np.float64)
1103-
return algos.arrmap_float64(q, _get_score)
1103+
result = [_get_score(x) for x in q]
1104+
result = np.array(result, dtype=np.float64)
1105+
return result
11041106

11051107

11061108
# --------------- #

pandas/tests/test_algos.py

-6
Original file line numberDiff line numberDiff line change
@@ -1685,12 +1685,6 @@ def test_pad_backfill_object_segfault():
16851685
tm.assert_numpy_array_equal(result, expected)
16861686

16871687

1688-
def test_arrmap():
1689-
values = np.array(["foo", "foo", "bar", "bar", "baz", "qux"], dtype="O")
1690-
result = libalgos.arrmap_object(values, lambda x: x in ["foo", "bar"])
1691-
assert result.dtype == np.bool_
1692-
1693-
16941688
class TestTseriesUtil:
16951689
def test_combineFunc(self):
16961690
pass

0 commit comments

Comments
 (0)