0% found this document useful (0 votes)
29 views5 pages

IP ASSIGNMENT (Class XII)

The document outlines a series of programming assignments focused on generating numerical series, manipulating dataframes using Python Pandas, and creating various types of charts and graphs. It includes tasks such as generating series of numbers, creating dataframes from dictionaries, performing operations on dataframes, and plotting histograms and line charts. Each question specifies the desired output and operations to be performed, emphasizing practical applications of Python programming and data visualization.

Uploaded by

Avni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views5 pages

IP ASSIGNMENT (Class XII)

The document outlines a series of programming assignments focused on generating numerical series, manipulating dataframes using Python Pandas, and creating various types of charts and graphs. It includes tasks such as generating series of numbers, creating dataframes from dictionaries, performing operations on dataframes, and plotting histograms and line charts. Each question specifies the desired output and operations to be performed, emphasizing practical applications of Python programming and data visualization.

Uploaded by

Avni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

ASSIGNMENT

Q1 Write a program to generate a series of the first 10 numbers.


Q2 Write a program to generate a series of float numbers from 21.0 to 30.0 with
an increment of 1.5 each.
Q3 Write a program to generate a series of 5 elements of multiples of 7 starting
with 35 with index multiply by 3.
Q4. Write a program to generate a series of 10 numbers with scalar value 33.
Q5. Write a program in Python Pandas to create the following
Dataframe batsman from a Dictionary:
B_no Name Score1 Score2
1 Sunil Pillai 90 80
2 Gaurav Sharma 65 45
3 Piyush Goel 70 90
4 Kartik Thakur 80 76

Perform the following operations on the Dataframe :


a. Add both the scores of a batsman and assign to column “Total”.
b. Display the highest score in both Score1 and Score2 of the Dataframe.
c. Display the Dataframe.
Q6. Consider a dataFrame df as shown below :
Col1 Col2 Col3 Col4
A 1.0 1 20.0 22.0
B 2.0 2 40.0 44.0
C 3.0 3 60.0 66.0
D 4.0 4 NaN NaN
E 5.0 5 NaN NaN
f NaN1 6 NaN NaN

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

Q10. Consider the following DataFrame, sports

Write commands to :
i. Add a new column ‘Winner’ to the Dataframe
ii. Add a new row with values ( s5 , 5 ,Handball, 20)

Q.11. ROLLNO NAME BST ECO


0 1201 vikram 78 80
1 1202 shivani 88 89
2 1303 vivek 76 82
3 1204 jaipriya 70 84
4 1205 simran 85 67
5 1206 cahitanya 78 88
Consider the above data frame CLASS, write commands to do the followings:
a. Display rows 2 to 4(both inclusive ) and columns ‘BST’ , ‘ECO’
b. Display rows 2 to 4(both inclusive ) and first 3 columns.

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

Q14. Plot following data on line chart:

Day Monday Tuesday Wednesday Thursday Friday

Income 510 350 475 580 600

1. Write a title for the chart “ The weekly Income Report”


2. Write the appropriate titles of both the axes.
3. Write a code to display legends.
4. Display red color for the line.
5. Use the line style-dashed
6. Display diamond style markers on data points .

Q15. The number of bed-sheets manufactured by a factory during five


consecutive weeks is given below.
Week First Second Third Fourth Fifth
Number of Bed-sheets 600 850 700 300 900
Draw the bar graph representing the above data

Q16 Write a program to create a line chart for following data-


x=[2,4,3,7,5]
y=[23,43,18,20,5]
Write code to
(a) Display dashed line
(b) Display + (plus) marker
(c )Change the marker color to blue

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]}

You might also like