Assignment - Numpy Array Operations

The objective of this assignment is to develop a solid understanding of Numpy array operations. In this assignment you will:

  1. Pick 5 interesting Numpy array functions by going through the documentation: https://numpy.org/doc/stable/reference/routines.html
  2. Run and modify this Jupyter notebook to illustrate their usage (some explanation and 3 examples for each function). Use your imagination to come up with interesting and unique examples.
  3. Upload this notebook to your Jovian profile using jovian.commit and make a submission here: https://jovian.ai/learn/zero-to-data-analyst-bootcamp/assignment/assignment-4-exploring-numpy-functions
  4. (Optional) Share your notebook online (on Twitter, LinkedIn, Facebook) and with the course community.
  5. (Optional) Check out the notebooks shared by other participants and give feedback & appreciation.

Try to give pick a theme for your assignment and give your notebook an interesting title e.g. "All about Numpy array operations", "5 Numpy functions you didn't know you needed", "A beginner's guide to broadcasting in Numpy", "Interesting ways to create Numpy arrays", "Trigonometic functions in Numpy", "How to use Python for Linear Algebra" etc.

NOTE: Remove this cell containing explanations before submitting or sharing your notebook online - to make it more presentable.

Frequently Used NumPy Functions In Data Science & Machine Learning

banner_img

What is NumPy?

  • NumPy stands for Numerical Python, a Python library used for working with arrays. It also has functions for working in domain of linear algebra, fourier transform, and matrices.

Why NumPy?

  • In Python we have lists that serve the purpose of arrays,but the are slow to process. NumpPy provide an array object that is up to 50X faster than traditional Python lists.

How NumPy is faster than Lists?

  • NumPy arrays are stored at one continuous place in memory unlike in lists, so processes can access and manipulate them very efficiently, This behavior is called Locality of Reference in computer science.
# Lets try this, will perform dot product between two large values

# Python list
arr1 = list(range(1000000))        
arr2 = list(range(1000000, 2000000))

# NumPy array
np_arr1 = np.array(arr1)
np_arr2 = np.array(arr2)
%%time

result = 0
for x, y in zip(arr1, arr2):
    result += x*y
result
CPU times: user 278 ms, sys: 0 ns, total: 278 ms Wall time: 278 ms
833332333333500000