Skip to content

Commit 4094088

Browse files
author
Santhosh Kumar Bethi
committed
fix assert frame eual for NA and dtype is false-61473
1 parent 1863adb commit 4094088

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pandas/_testing/asserters.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,9 @@ def assert_series_equal(
882882
Second Series to compare.
883883
check_dtype : bool, default True
884884
Whether to check the Series dtype is identical.
885+
check_dtype : bool, if False
886+
Whether to check the series is equal or not if dtype is
887+
False. (#GH #61473)
885888
check_index_type : bool or {'equiv'}, default 'equiv'
886889
Whether to check the Index class, dtype and inferred_type
887890
are identical.
@@ -1025,6 +1028,21 @@ def assert_series_equal(
10251028
pass
10261029
else:
10271030
assert_attr_equal("dtype", left, right, obj=f"Attributes of {obj}")
1031+
1032+
if not check_dtype:
1033+
# checks only when check_dtype is False
1034+
lv, rv = left._values, right._values
1035+
lv = np.asarray(lv, dtype=object)
1036+
rv = np.asarray(rv, dtype=object)
1037+
assert_numpy_array_equal(
1038+
lv,
1039+
rv,
1040+
check_dtype=check_dtype,
1041+
obj=str(obj),
1042+
index_values=left.index,
1043+
)
1044+
check_exact = False
1045+
10281046
if check_exact:
10291047
left_values = left._values
10301048
right_values = right._values

0 commit comments

Comments
 (0)