IP ASSIGNMENT (Class XII)
IP ASSIGNMENT (Class XII)
A. Write a command to create a new dataframe namely and that stores only
the first three rows and columns ‘Col2’ and ‘Col3’ from the above given
dataframe df.
B. Write a command to display only the records where the value stored
in’Col3’ is more than 30 .
C. Rite a command to count the number of non-null values stored in
i. Different columns of the dataframe df
ii. Different rows of the dataframe df
D. Write a command to print the average value of each column.
E. Write a command to display the row storing the maximum value of the
column ‘col1’.
Q7. Given a Dataframe df
Name Sex Position City Age Projects Budget
0 Rabia F Manager Bangalore 30 13 48
1 Evan M Programmer New Delhi 27 17 13
2 Jia F Manager Chennai 32 16 32
3 Lalit M Manager Mumbai 40 20 21
4 Jaspreet M Programmer Chennai 28 21 17
5 Suji F Programmer Bangalore 32 14 18
Write a program to print only the Name, Age and Position for all rows.
Q8. Given a list namely Area that stores the area of some states in km2.
Area=[34567,890,450,67892,34677,78902,256711,678291,637632,25723,2367
,11789,345,256517]
Write Python code to perform the following operations:
i. Create a Series object namely Ser1 using the list Area given above.
ii. Print the largest three areas from the series ser1.
iii. Print the smallest three areas from the series ser2
iv. Use the required libraries.
Q9. Suppose a data frame contains information about
student having columns rollno, name, class and section.
Write the code for the following:
i. Add one more column as fee
ii. Write syntax to transpose data frame.
iii. Write python code to delete column fee of data frame.
iv. Write the code to append df2 with df1
v. Display data of 1st to 3rd rows
Write commands to :
i. Add a new column ‘Winner’ to the Dataframe
ii. Add a new row with values ( s5 , 5 ,Handball, 20)
Q12. Draw the histogram based on the Production of Wheat in different Years
Year:2000,2002,2004,2006,2008,2010,2012,2014,2016,2018
Production':4,6,7,15,24,2,19,5,16,4
Q13. The table shows passenger car fuel rates in miles per gallon for several
years. Make a LINE GRAPH of the data. During which 2-year period did the
fuel rate decrease?
YEAR: 2000 2002 2004 2006
RATE: 21.0 20.7 21.2 21.6
Q17 Write a program to plot a bar chart in python to display the result of a
school for five consecutive years.
(a) Change the colour bars in sequence as red,yellow,green,blue,cyan
(b) Change width of bars in sequence as 0.5,0.6,0.7,0.8,0.9
Years=[2014,2015,2016,2017,2018]
PerResult=[91.0,89.7,84.2,98.9,94.3]
Q18 Write a program to create multiple line charts on common plot where three
data ranges are plotted on the same chart.
The data ranges to be plotted are-
DATA = [[5.,42.,28.,18.],[9.,13.,22.,29.],[8.,32.,26.,40.]]
(i) Display legends as Range1,Range2 and Range3.
(ii) Display label on x and y axes as X and Y respectively.
(iii) Add title as “Multirange line chart”
Q 19.Write a program to create the histogram for (a) to (g). The data is given
below-
Weight measurements for 16 small orders of French Fries (in grams).
78 72 69 81 63 67 65 73
79 74 71 83 71 79 80 69
(a) Create a simple histogram from above data.
(b) Create a horizontal histogram from above data.
(c) Create a step type of histogram from above data.
(d) Create a cumulative histogram from above data.
Q20. Write a program to read details such as item, sales made in a dataframe
and then store this data in a csv file.the dataframe is given below:
D={ ‘Fridge’:[12],’Cooker’:[5],’Juicer’:[15],’Iron:[11]}