Sie sind auf Seite 1von 2

Chapter 1 Working with Numpy

Answer the following:


1) What is Numpy?
2) What is the data type of Numpy?
3) In which form elements are stored in a Numpy?
4) What is the difference between Row Major and Column Major Numpy array?
5) What is the another name of Numpy array?
6) What are the various term associated with Numpy arrays?
7) What is the relationship between the rank of an array and the shape of the array?
8) Define Axes, Rank, Shape ItemSize and dType in terms of Numpy array.
9) How can you check data type of Numpy array?
10) Write the difference between Numpy array and Python list.
11) Does Numpy array support vectorized operation.
12) What are the advantages of Numpy array over python lists?
13) Which data type is not supported in Numpy for index operation
14) Which function is used to create Numpy array with dictionary and to perform operations on it.
15) What is the use of linespace() function? Write its syntax.
16) Which function is used to create a ndarray with sequence of number?
17) What is the use of reshape function?
18) How do we create empty Numpy array in Python?
19) Write and explain the syntax of empty numpy array.
20) How can we create a ndarray with the default value of 0 and 1?
21) How can we create a ndarray of 3x3 with random numbers between 0 and 100
22) What do you mean by array slicing? Explain with an example.
23) How we can concatenate multiple ndarray in python?
24) How can we split ndarray to get Contegious subsets.
25) What are the various functions to split ndarray?
26) Which functions allow you to extract only row or columns from an ndarray?
27) How we can extract condition based non-contiguous subsets?
28) What are contiguous and non contiguous subset?
29) What is the use of extract function?
30) What are the various function used on a ndarray for arithmetic operation?
31) Explain Covariance, Correlation and Linear Regression.
Application Based question:
1) Create a 4x4 two-dimensional ndarray from the range of integers 20..35.
2) Consider the following ndarray
import numpy as np
A=np.array([10,20,30,40,50,60,70,80,90])
B=np.array([[0,1,2,3],
[4,5,6,7],
[8,9,10,11],
[12,13,14,15]])
C=np.array([[10,11,12,13],
[14,15,16,17]])
i) What will be the output of the following code.
(a) B[0:2,1:3] (b) B[0:4:2,0:3:2] (c) B[:3,2:] (d) B[::-1]
(e) B[:3,6:1:-1] (f) A[2:6:3] (g) A[-1:-3] (h)A[-3:-1]
(i) A[-2:-6:-1] (j) A[6:2:-1] (k) A[2:8:3] (l) A[8:2:-3]

ii) What will be the output of the following code.


(a) D=np.concatenate([B,C])
print(D)
(b) D=np.concatenate([B[:2],C], axis=1)
print(D)
(c) D=np.concatenate([B[2:,:3],C[::,:3]], axis=0)
print(D)
(d) D=np.hstack([B[2:,:3],C[::,:3]])
print(D)
(e) D=np.vstack([B[3:,:3],C[::,:3]])
print(D)
(f) D=np.vstack([B,C])
print(D)
(g) np.hsplit(B,2) (h) np.vsplit(B,2)
(i) D=np.concatenate([B,C])
np.vsplit(D,3)
(j) D=np.add(B[:2],C)
print(D)

iii) Write a code to extract the subset from the ndarray B, containing the elements whose square is
fully divisible by 4.
iv) Write a code to multiple and print the subset by 5 from the ndarray B, containing the elements
whose square is fully an even number.
v) Write a code to extract the subset from the ndarray B, containing the elements whose cube is
fully an even number.

Das könnte Ihnen auch gefallen