2

I'm using Pandas to clean up some data and do basic statistics. I am wondering if quantile() does sort the values before the calculation or i must do the sorting beforehand?

For example, here I'm trying to get the 50th percentile of the number of workers in each company

Percentile50th = Y2015_df.groupby (["company"])["worker"].quantile(0.50)

I'm asking because when I was verifying the values I got with the results in MS Excel, I discovered that Median function requires the data to be sorted in order to get the right median. But I'm not sure if its the case in Pandas.

Shadin
  • 331
  • 1
  • 6
  • 14
  • 1
    No. Take a look at this.[enter link description here](https://stackoverflow.com/a/45495773/9136398) – Parth Batra Sep 27 '19 at 16:17
  • @Parth By no you mean it does not need any sorting from my side right? the function does the all the work.. just wanted to double-check – Shadin Sep 27 '19 at 16:31

1 Answers1

1

You do not need to sort. See the link in my previous comment. Example