def reshuffle(expr, by=None, sort=None, ascending=True):
    """
    Reshuffle data.

    :param expr:
    :param by: the sequence or scalar to shuffle by. RandomScalar as default
    :param sort: the sequence or scalar to sort.
    :param ascending: True if ascending else False
    :return: collection
    """

    by = by or RandomScalar()

    grouped = expr.groupby(by)
    if sort:
        grouped = grouped.sort_values(sort, ascending=ascending)

    return ReshuffledCollectionExpr(_input=grouped, _schema=expr._schema)
Reshuffle data.

    :param expr:
    :param by: the sequence or scalar to shuffle by. RandomScalar as default
    :param sort: the sequence or scalar to sort.
    :param ascending: True if ascending else False
    :return: collection