[REPORTED] NumPy Issue

In the next exercise i tried this code

rainfall = np.array([5.21, 3.76, 3.27, 2.35, 1.89, 1.55, 0.65, 1.06, 1.72, 3.35, 4.82, 5.11])

rain_mean = np.mean(rainfall)

rain_median = np.median(rainfall)

first_quarter = np.quantile(rainfall,0.25)
first_quarterr = np.percentile(rainfall,25)

But here don’t know why it gave this error

Traceback (most recent call last):
  File "script.py", line 9, in <module>
    first_quarter = np.quantile(rainfall,0.25)
AttributeError: 'module' object has no attribute 'quantile'

I knew there’s no point of error here so tried in Jupyter Notebook and it runs successfully

Please look into it @jephos249 @mtf
Link to the Exercise - Click Me

Seems the error message is pretty clear. There is no attribute ‘quantile’; but, there is likely an attribute, quartile.

But how is it possible in all the Previous Exercises we have been taught this command and it worked also in my Notebook

Most of all there’s no command like quartile but quantile

1 Like

Let me get caught up to you. I’m in and out so it might not be until a little later this afternoon. (It’s 1330h MDT, here.)

No no Don’t worry. It’s 2:20AM here and i’m gonna get some sleep.

I’ll keep giving it a go and see how I do.

Had a check of the numpy version running for these lessons (numpy.version.version) and it’s listed as 1.13.3 whereas the function you’re after says it’s ‘New in version 1.15.0.’. I’d assume previous lessons were using a different version for one reason or another. Perhaps it was partly intentional to remove some of numpy’s shortcuts and make learners follow the lessons more closely, who knows? :wink:

Details of the numpy.quantile function-


Thanks for checking. No point in my continuing with it, since there is an update needed. How are you at bug reports?

D’oh! We see that I stand corrected. As you were.

Let’s see where things stand once the information above gets to the Learning Experience team at CC.


Thankyou soo much for checking my Query @mtf @tgrtim. I’m really Grateful for it.

1 Like

Can you recall the lessons in which you were able to use this function? It does seem a little odd to swap between module versions if the lessons are linked together.

Quantile Function right… It’s this Exercise

1 Like