9
$\begingroup$

Let say this is my dataframe

x=[0.09, 0.95, 0.93, 0.93, 0.34, 0.29, 0.14, 0.23, 0.91, 0.31, 0.62,
       0.29, 0.71, 0.26, 0.79, 0.3 , 0.1 , 0.73, 0.63, 0.61]

x=pd.DataFrame(x)

When we x.describe() this dataframe we get result as this

>>> x.describe()
               0
count  20.000000
mean    0.50800
std     0.30277
min     0.09000
25%     0.28250
50%     0.47500
75%     0.74500
max     0.95000

What is meant by 25,50, and 75 percentile values? Is it saying 25% of values in x is less than 0.28250?

$\endgroup$
2

2 Answers 2

7
$\begingroup$

It describes the distribution of your data: 50 should be a value that describes „the middle“ of the data, also known as median. 25, 75 is the border of the upper/lower quarter of the data. You can get an idea of how skew your data is. Note that the mean is higher than the median, which means your data is right skewed.

Try:

import pandas as pd
x=[1,2,3,4,5]
x=pd.DataFrame(x)
x.describe()
$\endgroup$
1
$\begingroup$

First, seemingly, the describe table is not the description of your array x.

then, you need to sort your array (x), then calculate the location of your percentage ( which in .describe method p is 0.25, 0.5 and 0.75),

in your example:

sorted_x = [0.09, 0.1 , 0.14, 0.23, 0.26, 0.29, 0.29, 0.3 , 0.31, 0.34, 0.61, 0.62, 0.63, 0.71, 0.73, 0.79, 0.91, 0.93, 0.93, 0.95]

and the element in the which is located in 25th percentage is achieved when we divide the list to 25 and 75 percent, the shown | is 25% here:

sorted_x = [0.09, 0.1 , 0.14, 0.23, 0.26,**|** 0.29, 0.29, 0.3 , 0.31, 0.34, 0.61, 0.62, 0.63, 0.71, 0.73, 0.79, 0.91, 0.93, 0.93, 0.95]

So the value is calculated as $0.26 + (0.29-0.26)*\frac{3}{4}$ which equals $0.28250000000000003$

In general The percentile gives you the actual data that is located in that percentage of the data (undoubtedly after the array is sorted)

$\endgroup$
1
  • $\begingroup$ In the above example why the last value multiplied by is (3/4) $\endgroup$ Feb 26 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.