Skip to content

Sort on function of rows #2304

@jlumpe

Description

@jlumpe

It would be nice if there was a function to sort rows by some function of an entire DataFrameRow instead of by individual column values. An example implementation would be:

function permuterows!(df::DataFrame, p)
    for col in DataFrames._columns(df)
        permute!(col, p)
    end
    return df
end

function sortrows!(df::DataFrame; kw...)
    p = sortperm(eachrow(df); kw...)
    permuterows!(df, p)
    return df
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions