Very interesting. There is clearly a bug at least in my version of Pandas (0.25.1) with df.groupby(...).quantile(<array-like>). That codepath is different and seems to be broken even on very simple examples like:

df = pd.DataFrame(
    {"A": [0., 0., 0.], "B": ["X", "Y", "Z"]}
)
result = df.groupby("B").quantile([0.5, 0.9])

While it would work on a 2-element version one:

df = pd.DataFrame(
    {"A": [0., 0.], "B": ["X", "Y"]}
)
result = df.groupby("B").quantile([0.5, 0.9])

I would avoid using groupby with quantile on array-like objects until the code is fixed even in cases it works now since it is likely error-prone.

Blame also shows a lot of fairly fresh updates there (10, 16 months) dealing exactly with these pieces of code too.

Answer from Alexander Pivovarov on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › pandas-dataframe-quantile
Pandas DataFrame quantile() Method | Find Quantile Values - GeeksforGeeks
July 11, 2025 - Pandas quantile() function returns values at the given quantile over the requested axis.
🌐
W3Schools
w3schools.com › python › pandas › ref_df_quantile.asp
Pandas DataFrame quantile() Method
The quantile() method calculates the quantile of the values in a given axis.
🌐
GUVI
guvi.in › hub › pandas-tutorial › dataframe-quantile-method
Pandas DataFrame quantile() Method
Learn Pandas with this beginner-friendly handbook on GUVI Hub. Master DataFrames, data cleaning, filtering, and analysis techniques.
🌐
Spark By {Examples}
sparkbyexamples.com › home › pandas › pandas dataframe quantile() function
Pandas DataFrame quantile() Function - Spark By {Examples}
December 12, 2024 - You can calculate multiple quantiles in a single call by passing a list or an array of quantiles to the q parameter. This returns a DataFrame (for axis=0) or Series (for axis=1) with the corresponding quantile values. ... To calculate the 95th percentile of data in a Pandas DataFrame or Series, you can use the quantile() function and pass 0.95 as the argument.
Top answer
1 of 2
2

Very interesting. There is clearly a bug at least in my version of Pandas (0.25.1) with df.groupby(...).quantile(<array-like>). That codepath is different and seems to be broken even on very simple examples like:

df = pd.DataFrame(
    {"A": [0., 0., 0.], "B": ["X", "Y", "Z"]}
)
result = df.groupby("B").quantile([0.5, 0.9])

While it would work on a 2-element version one:

df = pd.DataFrame(
    {"A": [0., 0.], "B": ["X", "Y"]}
)
result = df.groupby("B").quantile([0.5, 0.9])

I would avoid using groupby with quantile on array-like objects until the code is fixed even in cases it works now since it is likely error-prone.

Blame also shows a lot of fairly fresh updates there (10, 16 months) dealing exactly with these pieces of code too.

2 of 2
1

You can't see quantile at work in both examples in the answer from @alexander-pivovarov. There are only zeros and only one element for each group, so the result is always zero. Or am I wrong here?

I have pandas 0.25.3 and get useful results for

import pandas as pd

df = pd.DataFrame(
    {"A": [1., 2., 3., 4., 5., 6.], "B": ["X", "X", "Y", "Y", "Z", "Z"]}
)
result = df.groupby("B").quantile([0.5, 0.9])
print(result)

Output:

        A
B         
X 0.5  1.5
  0.9  1.9
Y 0.5  3.5
  0.9  3.9
Z 0.5  5.5
  0.9  5.9

If it works with a single number passed to quantiles() you could hack something like

q = [0.2, 0.5, 0.9]
res = [df.groupby("B").quantile(_).loc['X', 'A'] for _ in q]

df_q = pd.DataFrame({'A':res, 'quantiles':q})

print(df_q)

Output:

     A  quantiles
0  1.2        0.2
1  1.5        0.5
2  1.9        0.9

until it is fixed.

Find elsewhere
🌐
Medium
medium.com › @amit25173 › understanding-pandas-dataframe-quantile-method-a4949d6807c4
Understanding pandas.DataFrame.quantile() Method | by Amit Yadav | Medium
March 6, 2025 - Let’s keep this simple: The quantile() method in pandas helps you figure out the value below which a certain percentage of your data falls.
🌐
Note.nkmk.me
note.nkmk.me › home › python › pandas
pandas: Find the quantile with quantile() | note.nkmk.me
January 19, 2024 - In pandas, the quantile() method allows you to find the quantiles for columns or rows in a DataFrame. This method is also available on Series. pandas.DataFrame.quantile — pandas 2.1.4 documentation p ...
🌐
Pandas
pandas.pydata.org › pandas-docs › version › 2.1.4 › reference › api › pandas.core.window.rolling.Rolling.quantile.html
pandas.core.window.rolling.Rolling.quantile — pandas 2.1.4 documentation
pandas.Series.quantile · Aggregating quantile for Series. pandas.DataFrame.quantile · Aggregating quantile for DataFrame. Examples · >>> s = pd.Series([1, 2, 3, 4]) >>> s.rolling(2).quantile(.4, interpolation='lower') 0 NaN 1 1.0 2 2.0 3 3.0 dtype: float64 ·
🌐
Data Science Discovery
discovery.cs.illinois.edu › guides › DataFrame-Fundamentals › finding-quantiles-of-a-column-in-dataframes
Finding Quantiles of a Column in a DataFrame - Data Science Discovery
August 2, 2022 - We can also find the 25% quantile, which is the value with 25% of the data to the left, and the 75% quantile, which is the value with 75% of the data to the left. Let's use a small DataFrame with information about movies to see this function in action! import pandas as pd\n&nbsp;\n# Creates ...
🌐
TutorialsPoint
tutorialspoint.com › finding-the-quantile-and-decile-ranks-of-a-pandas-dataframe-column
Finding the Quantile and Decile Ranks of a Pandas DataFrame column
August 21, 2023 - Use the rank() method with the pct parameter set to True to find the quantile rank of each observation in the column. Use the rank() method with the pct parameter set to True, the method parameter set to 'nearest', and the bins parameter set to 10 to find the decile rank of each observation ...
🌐
Pandas
pandas.pydata.org › pandas-docs › version › 0.23 › generated › pandas.DataFrame.quantile.html
pandas.DataFrame.quantile — pandas 0.23.1 documentation
Extending Pandas · Release Notes · Enter search terms or a module, class or function name. DataFrame.quantile(q=0.5, axis=0, numeric_only=True, interpolation='linear')[source]¶ · Return values at the given quantile over requested axis, a la numpy.percentile.
🌐
Medium
medium.com › @amit25173 › understanding-percentiles-in-pandas-369166d19e76
Understanding Percentiles in Pandas | by Amit Yadav | Medium
March 6, 2025 - What’s the difference between percentile and quantile in pandas? Answer: quantile() is a pandas method where you provide a value between 0 and 1 (e.g., 0.75 for the 75th percentile).
🌐
Apache
spark.apache.org › docs › latest › api › python › reference › pyspark.pandas › api › pyspark.pandas.DataFrame.quantile.html
pyspark.pandas.DataFrame.quantile — PySpark 4.1.1 documentation
Return value at the given quantile. ... Unlike pandas’, the quantile in pandas-on-Spark is an approximated quantile based upon approximate percentile computation because computing quantile across a large dataset is extremely expensive.
🌐
Datacomy
datacomy.com › data_analysis › pandas › quantile
Pandas: Quantile | Datacomy
March 13, 2020 - Help on function quantile in module pandas.core.frame: quantile(self, q=0.5, axis=0, numeric_only=True, interpolation='linear') Return values at the given quantile over requested axis. Parameters ---------- q : float or array-like, default 0.5 (50% quantile) Value between 0 <= q <= 1, the quantile(s) to compute.
🌐
Towards AI
pub.towardsai.net › part-4-data-manipulation-in-data-cleaning-8fe03673ae0e
Part 4: Data Manipulation in Data Cleaning | by Raj kumar
February 12, 2026 - We build Enterprise AI. We teach what we learn. Join 100K+ AI practitioners on Towards AI Academy. Free: 6-day Agentic AI Engineering Email Guide: https://email-course.towardsai.net/
🌐
Univ-dschang
siges-copy.univ-dschang.org › blog › mastering-pandas-quantile-a-complete-guide-1767646977
Mastering Pandas Quantile: A Complete Guide
January 6, 2026 - Univ-dschang brings you the latest in news, sports, and entertainment, all from a unique. Stay informed, stay entertained.
🌐
Saturn Cloud
saturncloud.io › blog › how-to-find-percentile-stats-of-a-given-column-using-pandas
How to Find Percentile Stats of a Given Column Using Pandas | Saturn Cloud Blog
December 26, 2023 - The quantile() function is used to find the percentile statistics of a given column in a Pandas DataFrame.