diff --git a/pandas/tests/series/test_npfuncs.py b/pandas/tests/series/test_npfuncs.py index a0b672fffa84a..6a575ab85943a 100644 --- a/pandas/tests/series/test_npfuncs.py +++ b/pandas/tests/series/test_npfuncs.py @@ -3,8 +3,10 @@ """ import numpy as np +import pytest from pandas import Series +import pandas._testing as tm class TestPtp: @@ -19,3 +21,15 @@ def test_ptp(self): def test_numpy_unique(datetime_series): # it works! np.unique(datetime_series) + + +@pytest.mark.parametrize("index", [["a", "b", "c", "d", "e"], None]) +def test_numpy_argwhere(index): + # GH#35331 + + s = Series(range(5), index=index, dtype=np.int64) + + result = np.argwhere(s > 2).astype(np.int64) + expected = np.array([[3], [4]], dtype=np.int64) + + tm.assert_numpy_array_equal(result, expected)