Finding the percentile rank of a value in a dataset. Noob needs comments on approach

Alternative ways to do it are.

This one will be fast:

julia> 100 * count(<(df_symbol.close[end]), df_symbol.close) / nrow(df_symbol)
72.83464566929133

or (this one is probably simple to understand)

julia> using Statistics

julia> 100 * mean(df_symbol.close .< df_symbol.close[end])
72.83464566929135

or (using a function designed for this means, the issue is that you need to learn it :slight_smile:):

julia> using StatsBase

julia> percentilerank(df_symbol.close, df_symbol.close[end], method=:strict)
72.83464566929135
8 Likes