[Python] How to calculate percentile rank of numpy array like in pandas

Discussão em 'Python' iniciado por Stack, Junho 30, 2025.

  1. Stack

    Stack Membro Participativo

    I have a Pandas DataFrame with 600 rows and 100 columns. I currently use this code to calculate rank in pandas:

    df[rankCols].transform('rank', pct=True)


    But I want to calculate it in numpy to improve speed. As I later convert my DataFrame to numpy array.

    How to calculate the same in numpy? I can rank using argsort() but it does not calculate percentile rank.

    Continue reading...

Compartilhe esta Página