#NEWLINE# def unique( array ) : #NEWLINE# #INDENT# '\n    Return the unique elements of the array U, as well as\n    the index array I such that U[I] == array\n\n    Parameters\n    ----------\n    array : `numpy.ndarray`\n        The array to use\n\n    Returns\n    -------\n    U : `numpy.ndarray`\n        The unique elements of the array\n    I : `numpy.ndarray`\n        The indices such that ``U[I] == array``\n    ' #NEWLINE# ( U , I ) = pd . factorize ( array , sort = True ) #NEWLINE# return ( I , U )