NumPy Exercises
Import NumPy as np
Create an array of 10 zeros
Create an array of 10 ones
Create an array of 10 fives
Create an array of the integers from 10 to 50
Create an array of all the even integers from 10 to 50
Create a 3x3 matrix with values ranging from 0 to 8
Create a 3x3 identity matrix
Use NumPy to generate a random number between 0 and 1
Random Integers
Select a int number from -10 to 10
make a 5 by 5 matrix with numbers from -10 to 10
Use NumPy to generate an array of 30 random numbers sampled from a standard normal distribution
Create the following matrix: numbers ranging from 0.01 to 1 , a total of 100 numbers and the matrix size of 10 by 10
Create an array of 10 linearly spaced points between 0 and 1:
In the following code, what do you think a predefined value is?
Numpy Indexing and Selection
Lets make a matrix and try to select different rows and columns from it
select all rows from 3rd row and the second column
when you need any specific number in matrix you can use this particular code
Take number 20 from the mat matrix
select all the rows till row number 4 in the 2nd column
finish this the upper code understanding before today (10) november morning need to finish the whole code untill night
Select the entire 5th row
Select all the columns between 4th row and the 5th row
Now Lets do some operations
Get the sum of all the values in mat What is the sum of all the elements in the matrix mat ?
Get the standard deviation of the values in mat
Get the sum of all the columns in mat
axis 0 = row and 1 = coloum
Get the sum of all the rows in mat
Lets convert lists into a vector
Lets make a function that does stuff we want with our matrix
Make a matrix generator function
Lets make a function thats selects portion of a matrix and generate a matrix from it
...oops we were hoping to get the original matrix but it got cut off, something wrong with the function............ How can we select the entire matrix with this function then?
Write a function that converts every row in a matrix into a list and then inputs the list into a dictionary and returns it
OK OK , IS this right do you think???????? If Not why?
... OK LSBU Elite.... Here is a challenge for you
How would you change the code to have the program to return a dictionary of columns?
HINT: Think Linear Algebra
Numpy and Time Series
OK , Cool lets now generate a Time series date columsn with Numpy
How many days are between these to dates?