Practice Assignment 1 : Numpy

Data Science Mastery Series: Python for Data Science

Module 3, Lesson 1 : Hands On Exercise - NumPy

In this practice exercise you need to work on the examples applying the various Numpy concepts learned. This practice will familiarize you with Numpy and its methods.

1.    Generate a List of even numbers between 1 and 50

  • Hint: Use range function, print the values.

2.   Print 10 elements starting from 5th element

3.   Create a Numpy Array from above list

4.   Using the above numpy array values, create a two-dimensional numpy array with elements containing only multiple of 5s with following structure:

  • Row 1  : [5, 15, 25, 35, 45]
  • Row 2 : [10, 20, 30, 40, 50]]

Hint: Use Slicing concept based on Condition.

5.   Print properties of this resultant array of multiples of 5:

  • Number of dimensions
  • Number of rows and columns
  • Data type of members

Hint: Use Slicing concept based on Condition

6.   Create another two dimensional Numpy Array with multiples of 5 between 100 and 150. Structure to be similar to step $.

  • Row 1  : [105, 115, 125, 135, 145]
  • Row 2 : [110, 120, 130, 140, 150]]

7.   Perform the following:

  • Add elements of the array
  • Stack the elements of the array row wise Hint use vstack
  • Stack the elements of the array col wise Hint use hstack

Complete and Continue