<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 <a href='http
Step1:  Create an array of 10 zeros
Step2:  Create an array of 10 ones
Step3:  Create an array of 10 fives
Step4:  Create an array of the integers from 10 to 50
Step5:  Create an array of all the even integers from 10 to 50
Step6:  Create a 3x3 matrix with values ranging from 0 to 8
Step7:  Create a 3x3 identity matrix
Step8:  Use NumPy to generate a random number between 0 and 1
Step9:  Use NumPy to generate an array of 25 random numbers sampled from a standard normal distribution
Step10:  Create the following matrix
Step11:  Create an array of 20 linearly spaced points between 0 and 1
Step12:  Numpy Indexing and Selection
Now you will be given a few matrices, and be asked to replicate the resulting matrix outputs
Step13:  Now do the following
Get the sum of all the values in mat
Step14:  Get the standard deviation of the values in mat
Step15:  Get the sum of all the columns in mat
<ASSISTANT_TASK:>
Python Code:
import numpy as np
Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a>
NumPy Exercises - Solutions
Now that we've learned about NumPy let's test your knowledge. We'll start off with a few simple tasks and then you'll be asked some more complicated questions.
Import NumPy as np
End of explanation
np.zeros(10)
Explanation: Create an array of 10 zeros
End of explanation
np.ones(10)
Explanation: Create an array of 10 ones
End of explanation
np.ones(10) * 5
Explanation: Create an array of 10 fives
End of explanation
np.arange(10,51)
Explanation: Create an array of the integers from 10 to 50
End of explanation
np.arange(10,51,2)
Explanation: Create an array of all the even integers from 10 to 50
End of explanation
np.arange(9).reshape(3,3)
Explanation: Create a 3x3 matrix with values ranging from 0 to 8
End of explanation
np.eye(3)
Explanation: Create a 3x3 identity matrix
End of explanation
np.random.rand(1)
Explanation: Use NumPy to generate a random number between 0 and 1
End of explanation
np.random.randn(25)
Explanation: Use NumPy to generate an array of 25 random numbers sampled from a standard normal distribution
End of explanation
np.arange(1,101).reshape(10,10) / 100
Explanation: Create the following matrix:
End of explanation
np.linspace(0,1,20)
Explanation: Create an array of 20 linearly spaced points between 0 and 1:
End of explanation
mat = np.arange(1,26).reshape(5,5)
mat
# WRITE CODE HERE THAT REPRODUCES THE OUTPUT OF THE CELL BELOW
# BE CAREFUL NOT TO RUN THE CELL BELOW, OTHERWISE YOU WON'T
# BE ABLE TO SEE THE OUTPUT ANY MORE
mat[2:,1:]
# WRITE CODE HERE THAT REPRODUCES THE OUTPUT OF THE CELL BELOW
# BE CAREFUL NOT TO RUN THE CELL BELOW, OTHERWISE YOU WON'T
# BE ABLE TO SEE THE OUTPUT ANY MORE
mat[3,4]
# WRITE CODE HERE THAT REPRODUCES THE OUTPUT OF THE CELL BELOW
# BE CAREFUL NOT TO RUN THE CELL BELOW, OTHERWISE YOU WON'T
# BE ABLE TO SEE THE OUTPUT ANY MORE
mat[:3,1:2]
# WRITE CODE HERE THAT REPRODUCES THE OUTPUT OF THE CELL BELOW
# BE CAREFUL NOT TO RUN THE CELL BELOW, OTHERWISE YOU WON'T
# BE ABLE TO SEE THE OUTPUT ANY MORE
mat[4,:]
# WRITE CODE HERE THAT REPRODUCES THE OUTPUT OF THE CELL BELOW
# BE CAREFUL NOT TO RUN THE CELL BELOW, OTHERWISE YOU WON'T
# BE ABLE TO SEE THE OUTPUT ANY MORE
mat[3:5,:]
Explanation: Numpy Indexing and Selection
Now you will be given a few matrices, and be asked to replicate the resulting matrix outputs:
End of explanation
mat.sum()
Explanation: Now do the following
Get the sum of all the values in mat
End of explanation
mat.std()
Explanation: Get the standard deviation of the values in mat
End of explanation
mat.sum(axis=0)
Explanation: Get the sum of all the columns in mat
End of explanation
<END_TASK>