Skip to content

Test for nested series equality #22400 #47627

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 6 commits into from
Jul 7, 2022
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
27 changes: 27 additions & 0 deletions pandas/tests/util/test_assert_series_equal.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import numpy as np
import pytest

from pandas.core.dtypes.common import is_extension_array_dtype
Expand Down Expand Up @@ -382,3 +383,29 @@ def test_assert_series_equal_identical_na(nulls_fixture):
# while we're here do Index too
idx = pd.Index(ser)
tm.assert_index_equal(idx, idx.copy(deep=True))


def test_identical_nested_series_is_equal():
# GH#22400
x = Series(
[
0,
0.0131142231938,
1.77774652865e-05,
np.array([0.4722720840328748, 0.4216929783681722]),
]
)
y = Series(
[
0,
0.0131142231938,
1.77774652865e-05,
np.array([0.4722720840328748, 0.4216929783681722]),
]
)
# These two arrays should be equal, nesting could cause issue

tm.assert_series_equal(x, x)
tm.assert_series_equal(x, x, check_exact=True)
tm.assert_series_equal(x, y)
tm.assert_series_equal(x, y, check_exact=True)