Professional Documents
Culture Documents
Module 7
Module 7
Introduction to NumPy
In this module, you will delve into NumPy, a powerful library in Python essential for numerical operations.
NumPy is particularly useful for handling arrays and performing complex mathematical operations with
ease. This module will introduce you to the basics of NumPy, including the creation and manipulation of
arrays. Understanding NumPy is a crucial skill for anyone looking to work with data in Python, as it lays the
groundwork for more advanced data analysis and scientific computing.
Please use W3Schools Online Web Tutorials website to learn the following topics during your Online
Guided Learning (OGL) session.
• Performing Basic Array Operations (Creating Arrays, Indexing, Slicing, Data Types, Shape, Reshape,
Iterating, Join, Split, Search, Sort, Filter, Random Number)
• Conduct basic operations on arrays such as addition, subtraction, and finding statistical values.
Question 1: Write a program using NumPy to create a 3x3 matrix with values ranging from 1 to 9. Then,
reshape this matrix into a 9x1 array.
Question 2: Create a 1D NumPy array of 20 elements with random values. Write a script to extract all
elements from the 5th to the 15th position and replace them with zero. Then find the mean, median,
and standard deviation of resulting array.