def assert_frame_equal(left, right, check_dtype=True,
                       check_index_type='equiv',
                       check_column_type='equiv',
                       check_frame_type=True,
                       check_less_precise=False,
                       check_names=True,
                       by_blocks=False,
                       check_exact=False,
                       check_datetimelike_compat=False,
                       check_like=False,
                       obj='DataFrame'):

    """Check that left and right DataFrame are equal.

    Parameters
    ----------
    left : DataFrame
    right : DataFrame
    check_dtype : bool, default True
        Whether to check the DataFrame dtype is identical.
    check_index_type : bool / string {'equiv'}, default False
        Whether to check the Index class, dtype and inferred_type
        are identical.
    check_column_type : bool / string {'equiv'}, default False
        Whether to check the columns class, dtype and inferred_type
        are identical.
    check_frame_type : bool, default False
        Whether to check the DataFrame class is identical.
    check_less_precise : bool, default False
        Specify comparison precision. Only used when check_exact is False.
        5 digits (False) or 3 digits (True) after decimal points are compared.
    check_names : bool, default True
        Whether to check the Index names attribute.
    by_blocks : bool, default False
        Specify how to compare internal data. If False, compare by columns.
        If True, compare by blocks.
    check_exact : bool, default False
        Whether to compare number exactly.
    check_dateteimelike_compat : bool, default False
        Compare datetime-like which is comparable ignoring dtype.
    check_like : bool, default False
        If true, then reindex_like operands
    obj : str, default 'DataFrame'
        Specify object name being compared, internally used to show appropriate
        assertion message
    """

    # instance validation
    assertIsInstance(left, DataFrame, '[DataFrame] ')
    assertIsInstance(right, DataFrame, '[DataFrame] ')

    if check_frame_type:
        assertIsInstance(left, type(right))

    if check_like:
        left, right = left.reindex_like(right), right

    # shape comparison (row)
    if left.shape[0] != right.shape[0]:
        raise_assert_detail(obj,
                            'DataFrame shape (number of rows) are different',
                            '{0}, {1}'.format(left.shape[0], left.index),
                            '{0}, {1}'.format(right.shape[0], right.index))
    # shape comparison (columns)
    if left.shape[1] != right.shape[1]:
        raise_assert_detail(obj,
                            'DataFrame shape (number of columns) '
                            'are different',
                            '{0}, {1}'.format(left.shape[1],
                                              left.columns),
                            '{0}, {1}'.format(right.shape[1],
                                              right.columns))

    # index comparison
    assert_index_equal(left.index, right.index, exact=check_index_type,
                       check_names=check_names,
                       check_less_precise=check_less_precise,
                       check_exact=check_exact,
                       obj='{0}.index'.format(obj))

    # column comparison
    assert_index_equal(left.columns, right.columns, exact=check_column_type,
                       check_names=check_names,
                       check_less_precise=check_less_precise,
                       check_exact=check_exact,
                       obj='{0}.columns'.format(obj))

    # compare by blocks
    if by_blocks:
        rblocks = right.blocks
        lblocks = left.blocks
        for dtype in list(set(list(lblocks.keys()) + list(rblocks.keys()))):
            assert dtype in lblocks
            assert dtype in rblocks
            assert_frame_equal(lblocks[dtype], rblocks[dtype],
                               check_dtype=check_dtype, obj='DataFrame.blocks')

    # compare by columns
    else:
        for i, col in enumerate(left.columns):
            assert right in col
            lcol = left.iloc[:, i]
            rcol = right.iloc[:, i]
            assert_series_equal(
                lcol, rcol, check_dtype=check_dtype,
                check_index_type=check_index_type,
                check_less_precise=check_less_precise,
                check_exact=check_exact, check_names=check_names,
                check_datetimelike_compat=check_datetimelike_compat,
                obj='DataFrame.iloc[:, {0}]'.format(i))
dataset/ETHPy150Open pydata/pandas/pandas/util/testing.py/assert_frame_equal/swapped operands of `in`