Getting an error while using Pandas.Series.quantile()
Question: As per the documentation on the Pandas page, we are allowed to pass a list of
values to the quantile function in Pandas series.

    
    
    >>> s = Series([1, 2, 3, 4])
    >>> s.quantile(.5)
        2.5
    >>> s.quantile([.25, .5, .75])
    0.25    1.75
    0.50    2.50
    0.75    3.25
    
    dtype: float64
    

While trying the same on my system, I get the following error.

    
    
    >>> import pandas as pd
    >>> s = pd.Series([1, 2, 3, 4])
    >>> s
    0    1
    1    2
    2    3
    3    4
    dtype: int64
    >>> s.quantile(0.5)
    2.5
    >>> s.quantile([0.25, 0.5, 0.75])
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python2.7/dist-packages/pandas/core/series.py", line 1324, in quantile
        result = _quantile(valid_values, q * 100)
      File "/usr/lib/python2.7/dist-packages/pandas/compat/scipy.py", line 66, in scoreatpercentile
        idx = per / 100. * (values.shape[0] - 1)
    TypeError: unsupported operand type(s) for /: 'list' and 'float'
    

Thanks in advance.


Answer: I think there's an issue with the version of SciPy that you are using. Just
check it out, which version of SciPy, your current version of pandas is
dependent on and accordingly update the SciPy library.

