Professional Documents
Culture Documents
Adobe Scan 14-May-2024
Adobe Scan 14-May-2024
1461
as np arr2
import numpy
[3,4,2]]. (14,6,5]. [3,1,6]11)
a=np.array(ll[1,2,3], print
b-np.random.randn(4,3)
(e) Expl=
print(a.shape)
print(b.shape)
() Expl
that can be used read
(b) Explain any two functions
with suitable
to create numpy array objects, (g) Expl
examples. (4)
objec
(c) Consider the given pandas series object and write
(h) Writ
the output of the following code statements (5)
Pythe
import pandas as pd
(i) Writ
obj2=pd.Series([4, 6, 5, 8, 7],index-['d', b', 'c',
'a', 'e]) impo
() print (obj2[*d'] ) df =
(ii) print (obj2 [obj2>5])
(ii) print (obj2.index)
(iv) print (obj2*3) print1
(v) print (obj2['b':'a'])
print(df.groupby(['Animal').mean()
(2)
Section B
.9, 10.1) 2. (a)
Write output of the
following code: (6)
P.T.O.
1461 4
1461
import pandas as pd
import numpy as np
import pandas as pd
data = pd.DataFrame(np.arange(12). reshape(3, 4),
index=['A', 'B', 'C], columns=['one', 'two', 'three',
Amjs 'four'])
Write the output for following :
() print(data)
(ii) print(data.sum)
rS giving (ii) print (data.sum(axis= 'columns'))
(49)
(iv) print (data.idxmax()
das series (v) print (data.cumsum())
including 4.
(5) (a) Explain the functions used for : (5)
P.T.O.
1461 7
year;qtrl;qtr2;qtr3;qtr4
2019;3000;3200;;3500
2020;2900;-9999;;
2021;1800;2 100;1900;1950
2021;1800;2 100;1900;1950
2022;1850;-9999;2900;2550
2023;3400;3200;;
horizontal and
to plot a
(a) Write Python statements assumed dataset. (5)
any
Vertical bar chart of
following
the
5) statements to do (10)
(b) Write the Python
nd
using matplotlib package : PTO.
(5)
8
1461 colours of 7
histogram of different
() Plot your city.
days temperature of
Days Temperature".
(i) Set title as "7
X-axis "Weekdays"
(iii) Set label for
"Temperature"
(iv) Set label for Y-axis
(v) Save the image as "temp-pick.jpg"
plots,
7 (a) Write short note on histograms and density
with suitable examples. (4)
(1000)
1461
6
1461 functions in pandas
dropna
fillna and (5)
(ey Explain example code.
dataframes, with
write
given dataframe df and
Consider the following
5. (a) statements to perform the
the Python (5)
operations:
ID marks
B23 52
A34 67
c25 60
as name
(i) Set the title of the row index
2,1,2
(i) Add a column 'semester with values
(ii) Sort the dataframe in descending order of
the marks columnn.