How Quantile calculate - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: How Quantile calculate (/thread-19550.html) |
How Quantile calculate - ift38375 - Jul-04-2019 Given below is source code for Pandas dataframe : import pandas as pd diSales= { 2016:{'qtr1':34500,'qtr2':56000,'qtr3':47000,'qtr4':49000}, 2017:{'qtr1':44900,'qtr2':46100,'qtr3':57000,'qtr4':59000}, 2018:{'qtr1':54500,'qtr2':51000,'qtr3':57000,'qtr4':58500}, 2019:{'qtr1':61000} } ks = pd.DataFrame(diSales) ptr = ks.quantile([0.25,0.5,0.75,1.0]) print(ptr)Output: What will be the mathematical formula/calculation for quantile ? How this output comes i don't know so please expalin with simple math calculation here .. RE: How Quantile calculate - ThomasL - Jul-04-2019 pandas.DataFrame.quantile https://en.wikipedia.org/wiki/Quantile RE: How Quantile calculate - ift38375 - Jul-04-2019 (Jul-04-2019, 05:13 AM)ThomasL Wrote: pandas.DataFrame.quantile anybody can explain how we can calculate first quartile value of column "2016" for row "0.25" and its value is 43875.0 ? Actually mathematically its value is wrong and correct value is 40750...please correct me if i am wrong ? Now problem has been resolved. i used interpolation as midpoint. interpolation : {‘linear’, ‘lower’, ‘higher’, ‘midpoint’, ‘nearest’} |