{"record":{"id":"ea8ae02cd2c3769e","repo":"pandas-dev/pandas","slug":"obj-are-different-message-left-left-ri","errorCode":null,"errorMessage":"{obj} are different\n\n{message}\n[left]:  {left}\n[right]: {right}","messagePattern":"(.+?) are different\n\n(.+?)\n\\[left\\]:  (.+?)\n\\[right\\]: (.+?)","errorType":"exception","errorClass":"AssertionError","httpStatus":null,"severity":"error","filePath":"pandas/_testing/asserters.py","lineNumber":735,"sourceCode":"    elif isinstance(left, (CategoricalDtype, StringDtype, NumpyEADtype)):\n        left = repr(left)\n\n    if isinstance(right, np.ndarray):\n        right = pprint_thing(right)\n    elif isinstance(right, (CategoricalDtype, StringDtype, NumpyEADtype)):\n        right = repr(right)\n\n    msg += f\"\"\"\n[left]:  {left}\n[right]: {right}\"\"\"\n\n    if diff is not None:\n        msg += f\"\\n[diff]: {diff}\"\n\n    if first_diff is not None:\n        msg += f\"\\n{first_diff}\"\n\n    raise AssertionError(msg)\n\n\ndef assert_numpy_array_equal(\n    left: Any,\n    right: Any,\n    strict_nan: bool = False,\n    check_dtype: bool | Literal[\"equiv\"] = True,\n    err_msg: str | None = None,\n    check_same: Literal[\"copy\", \"same\"] | None = None,\n    obj: str = \"numpy array\",\n    index_values: Index | np.ndarray | None = None,\n    *,\n    class_obj: str | None = None,\n) -> None:\n    \"\"\"\n    Check that 'np.ndarray' is equivalent.\n\n    Parameters","sourceCodeStart":717,"sourceCodeEnd":753,"githubUrl":"https://github.com/pandas-dev/pandas/blob/3b7651241d4da534b3559b60ef128e1c34f54116/pandas/_testing/asserters.py#L717-L753","documentation":"Raised by `raise_assert_detail`, the central failure formatter for pandas' testing asserters. It is the AssertionError surfaced when an equivalence check (lengths, shapes, classes, dtypes, values) finds a real difference. The message bundles the human-readable `[left]`/`[right]` reprs plus an optional `[diff]`, `[index]`, and first-difference block. This is the canonical 'your two objects are not equal' test failure.","triggerScenarios":"Any failed `assert_frame_equal`/`assert_series_equal`/`assert_index_equal` where left and right disagree on values, shape, dtype, or class; calling with `check_like=True` after reindexing that still leaves differences.","commonSituations":"Data pipeline regression tests where upstream produced a different dtype or rounding; refactors that reorder rows; floating-point comparisons done with default tolerance where rtol is too tight.","solutions":["Read the `[left]`/`[right]` blocks to identify the exact differing cell or property.","If the difference is floating-point noise, pass `check_exact=False` with appropriate `rtol`/`atol`.","If order is irrelevant, use `check_like=True` (for Series/Index) or sort both sides before asserting.","If dtype is the only diff, set `check_dtype=False` only when the difference is intentional."],"exampleFix":"// before\npd.testing.assert_series_equal(s_a, s_b)\n\n// after\npd.testing.assert_series_equal(s_a, s_b, check_exact=False, rtol=1e-6)","handlingStrategy":"validation","validationCode":"if not left.equals(right):\n    print(left.compare(right))  # preview the diff before asserting","typeGuard":null,"tryCatchPattern":"try:\n    pd.testing.assert_frame_equal(a, b, check_exact=False, rtol=1e-6)\nexcept AssertionError as e:\n    # save diff to a file for CI artifacts\n    raise","preventionTips":["Set rtol/atol explicitly for float comparisons.","Use check_like=True for order-insensitive compares."],"tags":["testing","assertions","data-comparison"],"backgroundTag":null,"analyzedSha":"3b7651241d4da534b3559b60ef128e1c34f54116","analyzedAt":"2026-08-11T22:10:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}