python 1
python 1
P.T.O.
2012
Section
First
Second
print(y)
print(z)
W=np.eye(2) * x
print(w)
P.T.O.
2012 4
(6)
) Consider the series SI and S2 given below :
S1 S2
A A 5
B B 6
3 D 7
D 4 E 8
()_I[: 3] * 10
iiY Si + S2
(ii) s2 [: : -1] * 5
Section B
19 in Age column.
P.T.0.
2012 6
[[S,10,201,
[20,13,43],
(34,27,67],
[12,46,771]
fi) matrix.T
() matrix[:1,1:]
(ii) matrix[[1,3,0],(2,1,0]]
(iv) matrix[[-2,-4]]
(vii) matrix[::-1]
P.T.O.
2012 8
(viii) matrix.ndim
(ix) np.swapaxes(matrix, 1, 0)
fx) matrix+10
P.T.0.
2012 10
Key Value
A List of numbers from1 to 10 skipping 2 at a time.
B List of Strings from A to E.
List of 5 numbers obtained using random normal
distribution function.
D List of 5 random integers from 20 to 30.
E Square root of 5 random numbers from 50 to 70.
P.T.0.
2012 12
(YSave data
data as a csv with separator as
11 = [10, 10, 20, 40, 50, 60, 70, 80, 90, 90]
P.T.O.
2012 14
2. df.yastack()
15
2012
) ) Give the output of the following code segment :
(4)
np.array((89, 54, 76, 32, 47, 21, 92, 39, 821)
arrl = arr[5:9]
arr2 = arr[5:9].copy()
arrl = 36
arr2 = 7
print(arr)
print(arrl )
pfint(arr2)
a = pd.Series([4, 1, 7, 1, 8, 9, 0, 8, 2, 3, 9])
(i) a.rank()
P.T.0.
2012 16
() a.rank(method = first)
(1500"