Starting from:

$35

CSE 106 – Lab 2 Solved



1.       In NumPy, do the following without hardcoding the values into the arrays or using for loops:

a.       Create and print a 4x2 matrix with values ranging from 2 to 10

b.       Create and print a 8x8 matrix and fill it with a checkerboard pattern [[0 1 0 1 0 1 0 1]

..........

[0  1 0 1 0 1 0 1]

[1  0 1 0 1 0 1 0]]

c.       Get the unique values of a list

i. List = [10, 20, 10, 30, 20, 40, 20, 20, 10, 30, 0, 50, 10]

d.       Get the values greater than 37 in the list

i. List = [6, 75, 9, 82, 36, 42, 59, 3, 52, 1, 32, 68, 93, 4, 27, 85, 0, -3, 57]

e.       Convert the values of a list of values in Centigrade into Fahrenheit degrees

i. List = [0, 12, 45.21 ,34, 99.91]

2.       Given the following two matrices, output the results of the operations with NumPy:

                                                                                  1     2     3                  3     1     4

                                                                       𝐴 = [4     5      6]   𝐵 = [2      6     1]

                                                                                  7     8     9                  2     9     7

a.       A + B

b.       A X B

c.       Determinate of A

d.       Inverse of B

e.       Eigenvalues of A

3.       In Pandas, parse the file “weather_data.txt” and output the answers to the following:

a.       What day(s) had the highest actual precipitation?

b.       What was the average actual max temp for July 2014?

c.       What days was the actual max temp the record max temp?

d.       How much did it rain in October 2014?

e.       What day(s), if any, was the actual low temperature below 60 degrees and actual max temperature above 90 degrees on the same day?

4.       In Pandas, parse the file “weather_data.txt” and create the following plots (with titles, labels and a legend):

a.       Actual max temperature and actual min temperature on the same line chart (max should be a red line, min should be blue)

b.       A histogram of actual precipitation

More products