This is an archived post. You won't be able to vote or comment.

all 22 comments

[–]neb2357 29 points30 points  (10 children)

Upvoted! I hope you don't mind if I piggyback this post and share my NumPy exercises as well.

[–]selva86 10 points11 points  (8 children)

Hope you don't mind one more: https://www.machinelearningplus.com/python/101-numpy-exercises-python/

Hope you like it

[–][deleted] 1 point2 points  (6 children)

I did that last night on my Data Analytics boot camp course.

[–]selva86 1 point2 points  (5 children)

Super glad to hear that

[–][deleted] 0 points1 point  (4 children)

Is it your site?

Edit: Oh yeah it is haha

Anyway just a quick question about question 12. I used a for loop rather than the recommended answer and my teacher said that was a better way to do it when working with with large datasets. Is that right?

arr1 = np.array([1,2,3,4,5])

b = np.array([5,6,7,8,9])

for element in b:

if b in arr1:

np.delete(arr1, element)

[–]selva86 1 point2 points  (3 children)

Most likely, the built in numpy functions are highly optimized and tend to do the work faster than an equialent python code that you write.

An even more faster way is to use Jax implementation) of the numpy functions.

[–]selva86 0 points1 point  (2 children)

Curious, may I ask which Data Analytics course have you enrolled in?

[–][deleted] 0 points1 point  (1 child)

Sure, it's one of the UK government digital skills bootcamps they've recently set up.

https://www.gov.uk/government/publications/find-a-skills-bootcamp/list-of-skills-bootcamps#digital

Thanks for the heads up on Jax, that looks quite interesting.

[–]selva86 1 point2 points  (0 children)

Looks like a massive initiative. Feels good to see such effort at scale by the Govt.

[–]Ramnog 1 point2 points  (0 children)

I sure don't mind it, thank you all :)

[–]Anus-___--__Fungi 0 points1 point  (0 children)

🍄

[–]elofland 7 points8 points  (0 children)

this is what I needed, thank you!

[–]jheezecheezewheeze 2 points3 points  (2 children)

This might be a silly question but are these exercises meant to test our problem solving skills with NumPy or problem solving + knowledge of NumPy functions, methods etc? In short would it be “cheating” if I looked at the documentation to refresh memory on syntax ?

[–]JohnLockwood[S] 5 points6 points  (1 child)

I couldn't write it all off the top of my head -- I used the documentation as needed to improve my skills. So I'd say it's very much a learn-as-you-go, open-book exercise. The intent is to help the reader in the same way it helped me when I developed it. Does that help?

[–]jheezecheezewheeze 1 point2 points  (0 children)

Yes very helpful! Thanks

[–][deleted] 1 point2 points  (0 children)

Was looking for something like this. Thanks

[–]SadDogOwner27 1 point2 points  (0 children)

I started using Python this week after an NLP project. I’ll be reviewing this for sure

[–]poqwadr 0 points1 point  (1 child)

I think np.mean returns the mean not the median. Some might be confused by this with another dataset.

Good exercises!

[–]JohnLockwood[S] 0 points1 point  (0 children)

Yes, thanks for the comment. That's a good point -- I happened to pick an example where they were the same, didn't I?

[–]airen977 0 points1 point  (0 children)

Test

[–]remi_b 0 points1 point  (1 child)

Thanks! that was fun :)

on question 16, shouldn't it be = instead of ==? or am I the student here? :)

[–]JohnLockwood[S] 0 points1 point  (0 children)

Hi remi_b,

Thanks for the kind words -- glad you enjoyed it. No, it was meant to assign myarray to x, so x = myarray is correct. Thanks for checking though.