@@ -1289,6 +1289,7 @@ def assert_series_equal(
1289
1289
rtol = 1.0e-5 ,
1290
1290
atol = 1.0e-8 ,
1291
1291
obj = "Series" ,
1292
+ check_index = True ,
1292
1293
):
1293
1294
"""
1294
1295
Check that left and right Series are equal.
@@ -1348,6 +1349,10 @@ def assert_series_equal(
1348
1349
obj : str, default 'Series'
1349
1350
Specify object name being compared, internally used to show appropriate
1350
1351
assertion message.
1352
+ check_index : bool, default True
1353
+ Whether to check index equivalence. If False, then compare only values.
1354
+
1355
+ .. versionadded:: 1.2.0
1351
1356
1352
1357
Examples
1353
1358
--------
@@ -1383,18 +1388,20 @@ def assert_series_equal(
1383
1388
if check_flags :
1384
1389
assert left .flags == right .flags , f"{ repr (left .flags )} != { repr (right .flags )} "
1385
1390
1386
- # index comparison
1387
- assert_index_equal (
1388
- left .index ,
1389
- right .index ,
1390
- exact = check_index_type ,
1391
- check_names = check_names ,
1392
- check_exact = check_exact ,
1393
- check_categorical = check_categorical ,
1394
- rtol = rtol ,
1395
- atol = atol ,
1396
- obj = f"{ obj } .index" ,
1397
- )
1391
+ if check_index :
1392
+ # GH #38183
1393
+ assert_index_equal (
1394
+ left .index ,
1395
+ right .index ,
1396
+ exact = check_index_type ,
1397
+ check_names = check_names ,
1398
+ check_exact = check_exact ,
1399
+ check_categorical = check_categorical ,
1400
+ rtol = rtol ,
1401
+ atol = atol ,
1402
+ obj = f"{ obj } .index" ,
1403
+ )
1404
+
1398
1405
if check_freq and isinstance (left .index , (pd .DatetimeIndex , pd .TimedeltaIndex )):
1399
1406
lidx = left .index
1400
1407
ridx = right .index
@@ -1703,6 +1710,7 @@ def assert_frame_equal(
1703
1710
obj = f'{ obj } .iloc[:, { i } ] (column name="{ col } ")' ,
1704
1711
rtol = rtol ,
1705
1712
atol = atol ,
1713
+ check_index = False ,
1706
1714
)
1707
1715
1708
1716
0 commit comments