How to calculate median, 25th, and 75th percentile values in a Pandas Series?

I was learning and exploring some series statistics that are normally used in the analysis of the data and found out about the median value, the 25th percentile value, and the 75th percentile value. Can someone provide me with alternative ways of finding these statistical values? I have attached the way I found and used below:

The Median Value:

The 25th and 75th Percentile Values:

Also, I would appreciate it if someone also tells me more about what is meant by a percentile and what 25th and 75th percentile values are.

  • The quantile() method returns the value at the given quantile of the series. To find the median value, we can use q=0.5.

  • In statistics, a quantile is a value that divides a data distribution into intervals of equal probability, and they are useful for summarizing the distribution of a dataset.

  • Specifying q = 0.5 means the value that divides the data into two equal parts; hence, this is how we get the median value.

@mubashir_rizvi, Percentile is defined as the value below which a given percentage of observations in a group of data falls.
25th percentile is also known as the first quartile, and it is a statistical measure that indicates the value below which 25% of the data lies.
75th percentile is also known as the third quartile, and it is a statistical measure that indicates the value below which 75% of the data lies.

To find the 25th and 75th percentiles, you can call the scoreatpercentile() function with a parameter of 25 and 75. The scipy.stats.scoreatpercentile() function can be used to find the nth percentile of a series. You can also pass a list of percentile values we want. Let’s see the example given below for a better understanding: