Join list of cartesians into one molecule.

    Wrapper around the :func:`pandas.concat` function.
    Default values are the same as in the pandas function except for
    ``verify_integrity`` which is set to true in case of this library.

    Args:
        ignore_index (sequence, bool, int): If it is a boolean, it
            behaves like in the description of
            :meth:`pandas.DataFrame.append`.
            If it is a sequence, it becomes the new index.
            If it is an integer,
            ``range(ignore_index, ignore_index + len(new))``
            becomes the new index.
        keys (sequence): If multiple levels passed, should contain tuples.
            Construct hierarchical index using the passed keys as
            the outermost level

    Returns:
        Cartesian:

def concat(cartesians, ignore_index=False, keys=None):
    """Join list of cartesians into one molecule.

    Wrapper around the :func:`pandas.concat` function.
    Default values are the same as in the pandas function except for
    ``verify_integrity`` which is set to true in case of this library.

    Args:
        ignore_index (sequence, bool, int): If it is a boolean, it
            behaves like in the description of
            :meth:`pandas.DataFrame.append`.
            If it is a sequence, it becomes the new index.
            If it is an integer,
            ``range(ignore_index, ignore_index + len(new))``
            becomes the new index.
        keys (sequence): If multiple levels passed, should contain tuples.
            Construct hierarchical index using the passed keys as
            the outermost level

    Returns:
        Cartesian:
    """
    frames = [molecule._frame for molecule in cartesians]
    new = pd.concat(frames, ignore_index=ignore_index, keys=keys,
                    verify_integrity=True)

    if type(ignore_index) is bool:
        new = pd.concat(frames, ignore_index=ignore_index, keys=keys,
                        verify_integrity=True)
    else:
        new = pd.concat(frames, ignore_index=True, keys=keys,
                        verify_integrity=True)
        if type(ignore_index) is int:
            new.index = range(ignore_index,
                              ignore_index + len(new))
        else:
            new.index = ignore_index
    return cartesians[0].__class__(new)