@@ -1315,6 +1315,9 @@ def assert_frame_equal(
13151315 if check_like :
13161316 left = left .reindex_like (right )
13171317
1318+ column_errors = []
1319+ first_error_message = None
1320+
13181321 # compare by blocks
13191322 if by_blocks :
13201323 rblocks = right ._to_dict_of_blocks ()
@@ -1338,29 +1341,45 @@ def assert_frame_equal(
13381341 # use check_index=False, because we do not want to run
13391342 # assert_index_equal for each column,
13401343 # as we already checked it for the whole dataframe before.
1341- with warnings .catch_warnings ():
1342- warnings .filterwarnings (
1343- "ignore" ,
1344- message = "the 'check_datetimelike_compat' keyword" ,
1345- category = Pandas4Warning ,
1346- )
1347- assert_series_equal (
1348- lcol ,
1349- rcol ,
1350- check_dtype = check_dtype ,
1351- check_index_type = check_index_type ,
1352- check_exact = check_exact ,
1353- check_names = check_names ,
1354- check_datetimelike_compat = check_datetimelike_compat ,
1355- check_categorical = check_categorical ,
1356- check_freq = check_freq ,
1357- obj = f'{ obj } .iloc[:, { i } ] (column name="{ col } ")' ,
1358- rtol = rtol ,
1359- atol = atol ,
1360- check_index = False ,
1361- check_flags = False ,
1362- )
1363-
1344+ try :
1345+ with warnings .catch_warnings ():
1346+ warnings .filterwarnings (
1347+ "ignore" ,
1348+ message = "the 'check_datetimelike_compat' keyword" ,
1349+ category = Pandas4Warning ,
1350+ )
1351+ assert_series_equal (
1352+ lcol ,
1353+ rcol ,
1354+ check_dtype = check_dtype ,
1355+ check_index_type = check_index_type ,
1356+ check_exact = check_exact ,
1357+ check_names = check_names ,
1358+ check_datetimelike_compat = check_datetimelike_compat ,
1359+ check_categorical = check_categorical ,
1360+ check_freq = check_freq ,
1361+ obj = f'{ obj } .iloc[:, { i } ] (column name="{ col } ")' ,
1362+ rtol = rtol ,
1363+ atol = atol ,
1364+ check_index = False ,
1365+ check_flags = False ,
1366+ )
1367+ except AssertionError as e :
1368+ column_errors .append ((i , col ))
1369+ if first_error_message is None :
1370+ first_error_message = str (e )
1371+
1372+ if column_errors :
1373+ column_indices = [idx for idx , _ in column_errors ]
1374+ column_names = [name for _ , name in column_errors ]
1375+
1376+ error_summary = f"{ obj } are different\n \n "
1377+ error_summary += f"Columns with differences (positions { column_indices } ):\n "
1378+ error_summary += f"{ column_names } \n \n "
1379+ error_summary += f"First difference details:\n "
1380+ error_summary += first_error_message
1381+
1382+ raise AssertionError (error_summary )
13641383
13651384def assert_equal (left , right , ** kwargs ) -> None :
13661385 """
0 commit comments