How to find rankings of each tuple in the list of tuples?

julia> using StatsBase

julia> collect(zip(first.(v),denserank(last.(v))))
4-element Vector{Tuple{Int64, Int64}}:
 (1, 3)
 (2, 2)
 (4, 2)
 (5, 1)

For more information about denserank, the usual, press ? for help and type denserank will do.

3 Likes