I have an array of 500 numbers and I'd like to calculate the percentile of each value:
import numpy as np
import pandas as pd
df = np.random.random(500)
desired_output = pd.DataFrame(df).rank(pct=True)
Except without using pandas, since I have this in a long loop and it must be as fast as possible.