In statistics, a percentile (or centile) is the value of a variable below which a certain percent of observations fall.
Questions tagged [percentile]
739 questions
5
votes
1 answer
Assigning percentile to each value of pandas series
Is there a direct out-of-the-box way to assign percentile to each of the values of pandas series?
I'm achieving this calculation via ranking and rescaling, like here:
values = pd.Series(np.random.normal(0,1,100))
percentiles =…

Dimgold
- 2,748
- 5
- 26
- 49
5
votes
1 answer
Use ntile() with group_by() with dplyr
I want to calculate the quintile of groups in a data.frame such as this:
df <- data.frame(x=1:100, y=c(rep("A", 50), rep("B", 50)))
Using the ntile() function and group_by from dplyr, I thought I could get the grouped quintiles such as here.…

Marco Pastor Mayo
- 803
- 11
- 25
5
votes
3 answers
percentile for datetime column python
Is there a way to compute the percentile for a dataframe column with datetime format while still retaining the datetime format (Y-m-d H:M:S) and not converted to seconds for the percentile value?
example of the data with datetime format
df:
0 …

T-Jay
- 347
- 1
- 4
- 16
5
votes
2 answers
Average calculation by eliminating top 10% & bottom 10% values using T-SQL
I need to calculate the average duration of one of our running stored procedures. For example the duration(in seconds) of SP are:
1,30,2,5,2,15,35,7,3,4,2,1,2,40
I have to eliminate top 10% calls (fast calls) & bottom 10% calls (slow calls) &…

Siva Dasari
- 1,059
- 2
- 19
- 40
5
votes
1 answer
Conditional array to calculate percentiles
I have some data as follows:
val crit perc
0.415605498 1 perc1
0.475426007 1 perc1
0.418621318 1 perc1
0.51608229 1 perc1
0.452307882 1 perc1
0.496691416 1 perc1
0.402689126 1 perc1
0.494381345 1 perc1
0.532406777 1 …

Chris. Z
- 365
- 1
- 7
- 17
5
votes
0 answers
Node.js event loop latency testing
I measure nodejs event loop using process.hrtime() also I count percentiles for measuring intervals.
Here is my simple benchmark example
I have run this test on PC with CPU i7-4770.
This is how graph looks like when script runs on Windows 7(same…

Vladimir Korzhev
- 86
- 5
5
votes
2 answers
Getting quantiles from a beta distribution using python
I need to get the Nth quantile of a beta distribution, or equivalently, the 95% or 99% percentile. This is so much easier in Maple, which allows symbolic input -- but how is this done in Python?
I've searched stackoverflow, and it seems that people…

irene
- 2,085
- 1
- 22
- 36
5
votes
6 answers
Quartiles in SQL query
I have a very simple table like that:
CREATE TABLE IF NOT EXISTS LuxLog (
Sensor TINYINT,
Lux INT,
PRIMARY KEY(Sensor)
)
It contains thousands of logs from different sensors.
I would like to have Q1 and Q3 for all sensors.
I can do one query…

Hamma
- 183
- 1
- 4
- 12
5
votes
3 answers
Calculate Percentile using LINQ
All,
Having reviewed StackOverflow and the wider internet, I am still struggling to efficiently calculate Percentiles using LINQ.
Where a percentile is a measure used in statistics indicating the value below which a given percentage of…

shansen
- 265
- 4
- 14
5
votes
3 answers
Cumulative sum of variable till a given percentile
I would like to sum up all the values in an array till a given percentile.
E.g.
import numpy as np
a = [15, 40, 124, 282, 914, 308]
print np.percentile(a,90)
The 90th percentile is ~611 and the cumulative sum till then is 461
Is there any function…

user308827
- 21,227
- 87
- 254
- 417
5
votes
1 answer
Perl: Most efficent way to calculate percentile
I have a perl script, that goes through a couple of gig worth of files and generates a report.
In order to calculate percentile i am doing the following
my @values = 0;
while (my $line = ){
.....
push(@values, $line);
}
#…

ZOXIS
- 578
- 5
- 15
5
votes
1 answer
Adding Different Percentiles in boxplots in R
I am failry new to R and recently used it to make some Boxplots. I also added the mean and standard deviation in my boxplot. I was wondering if i could add some kind of tick mark or circle in different percentile as well. Let's say if i want to…

Gyve
- 57
- 1
- 7
5
votes
2 answers
Find percentile using an array in php
I have a array like this
array(
45=>5,
42=>4.9,
48=>5,
41=>4.8,
40=>4.9,
34=>4.9,
.....
)
Here index is userid and value is his score.
Now what i want is to achieve percentile for on user for example…

Ajay Kadyan
- 1,081
- 2
- 13
- 36
5
votes
2 answers
Definitive way to match Stata weighted xtile command using Python?
For a project, I need to replicate some results that currently exist in Stata output files (.dta) and were computed from an older Stata script. The new version of the project needs to be written in Python.
The specific part I am having difficulty…

ely
- 74,674
- 34
- 147
- 228
4
votes
3 answers
Perl PDL - getting the 80% lowest values in a vector
Is there an elegant PDL function which receives a list of values and returns a list of 80% of the original values which are the lowest?
For example:
If I have a list like so: (9, 4, 1, 2, 7, 8, 3, 5, 6, 10)
I would like to get (1, 2, 3, 4, 5, 6, 7,…

N.M
- 685
- 1
- 9
- 22