Skip to content

TST: adds test for Series and argwhere interaction #53381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pandas/tests/series/test_npfuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
"""

import numpy as np
import pytest

from pandas import Series
import pandas._testing as tm


class TestPtp:
Expand All @@ -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)