0% found this document useful (0 votes)
252 views

IP Project 12A

The document appears to be a student project submission covering reading, manipulating, analyzing, and visualizing CSV data. It includes an acknowledgements section thanking the teacher for guidance and parents for help. The project contains questions and code snippets related to creating and working with Pandas Series and DataFrames.

Uploaded by

GVWScls1
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)
252 views

IP Project 12A

The document appears to be a student project submission covering reading, manipulating, analyzing, and visualizing CSV data. It includes an acknowledgements section thanking the teacher for guidance and parents for help. The project contains questions and code snippets related to creating and working with Pandas Series and DataFrames.

Uploaded by

GVWScls1
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/ 39

St. ANSELM’S SR. SEC.

SCHOOL
HEERA PATH,
MANSAROVAR, JAIPUR

Project
INFORMATICS PRACTICES
SESSION – 2023-24
SUBMITTED TO: SUBMITTED BY:
Ms. Vandana Rathore Nivedit Pathak
(IP TEACHER) Class XII ‘A'
Roll No.- 27
Scholar No.- 6126
CERTIFICATE
This is to certify that Nivedit Pathak of class
XII ‘A’ has completed Project on the topics
Reading CSV File, Manipulation, Analysis,
Visualisation for Internal Assessment session
2023-24.
ACKNOWLEDGEMENT
I would like to express my special thanks and
gratitude to my IP teacher, Ms. Vandana
Rathore. Who gave me the golden opportunity
to do this wonderful project, which also helped
me to know about so many new concepts. I am
making this project not only for marks but to
also increase my knowledge.
Further, I would also like to thank my parents
who helped me a lot in finalizing this project
within the limited time frame.

Nivedit Pathak
Class: XII ‘A’
Roll No. – 27
Scholar No. - 6126
INDEx
S. No. Particulars Sign.
MAIN MENU
1 READ CSV FILE
1a dataframe 1
1b dataframe2
2 MANIPULATION
2a add new row
2b add new column
2c delete a column
2d delete a row
2e modify values of a row
2f modify values of a column
2g modify single value
3 ANALYSIS
3a display first n rows
3b display last n rows
3c display nonadjacent columns
3d display nonadjacent rows
3e display shape, size, information
3f display asked value
4 VISUALISATION
4a bar chart
4b line chart
4c histogram
4d pie chart
5 Exit
-: Question – 1 :-
Write a program to create a Series object using a dictionary that stores the number of students in
each section of class 12 in your class.
Code: -

Output: -
-: Question – 2 :-
Write a program to create a Series object using individual vowel characters.
Code: -

Output: -
-: Question – 3 :-
Write a program to create a Series object using an ndarray that is created by tiling a list [1,2,3]. Use
np.tile() methods.
Code: -

Output: -
-: Question – 4 :-
Sequences section and contri1 stores the section names (‘A’, ‘B’, ‘C’, ‘D’, ‘E’) and contribution made
by them respectively (6700, 5600, 5000, nil) for a charity. Your school has decided to donate as much
contribution as made by each section, i.e. the donation will be doubled.
Write code to create a Series object that stores the contribution amount as the values and the section
names as the indexes with datatype as float32.
Code: -

Output: -
-: Question – 5 :-
Write a program to create a Series object that stores the initial budget allocated (5000.00 each) for
the four quarters of the year.
Code: -

Output: -
-: Question – 6 :-
Write Python program to Create a DataFrame with the help of dictionary, which contains the
information about Marks of Five students of five subjects.

Dictionary Contains – [Write commands to create dictionary also]

Name Maths Sc SSc Hindi Total


Aditya 85 95 80 70 330
Saloni 95 100 100 99 394
Muskan 88 99 99 99 385
Tamanna 99 88 99 98 384
Code: -

Output: -
-: Question – 7 :-
Write python code to create a data frame from a 2D dictionary, Sales which stores the quarter-wise
sales as inner dictionary for two years, as shown below :
Sales = {‘yr1’ : {‘q1’ : 34000, ‘q2’ : 56000, ‘q3’: 85000},
‘yr2’ : {‘q1’ : 44000, ‘q2’ : 66000, ‘q3’: 55000} }
Code: -

Output: -
Question – 8
Write a program to create a data frame from a list containing dictionaries of the sales performance
of four zonal offices. Zone names should be the row labels.
Code: -

Output: -
Question – 9
Write a program to create a DataFrame to store weight, age and name of 3 people. Print the
DataFrame and its index, columns, axes, dtypes, number of rows, number of non-NaN values in each
column, and transpose of data frame. [Attributes of DataFrame]
Code: -

Output: -
Question - 10
Consider the following DataFrame saleDF:-
Target Sales
zoneA 56000 58000
zoneB 70000 68000
zoneC 75000 78000
zoneD 60000 61000

Write a program to add a column namely Orders having values 6000, 6700, 6200, and 6000
respectively for the zones A, B, C and D. The program should also add a new row for a for a new
zone ZoneE. Add some dummy values in this row.

Code: -
Output: -
Question – 11
Create a DataFrame cityStat having following information –
Population Hospitals Schools
Delhi 10927986.0 189.0 7916.0
Mumbai 12691836.0 208.0 8508.0
Kolkata 4631392.0 149.0 7226.0
Chennai 4328063.0 157.0 7617.0
Bangalore 5678097.0 1200.0 1200.0

From the above DataFrame cityStat, create another DataFrame and it must not contain the column
‘Population’ and the row ‘Banglore’
Code: -

Output: -
Question – 12
Write a program to read from a CSV file employee.csv and create a dataframe from it, but dataframe
should not use file’s column header rather should use own column numbers as 0, 1, 2, ……
Code: -

CSV File :-

Output: -
Question - 13
Write a program to store the allDf DataFrame of previous example in fill alln.csv with separator
character ‘|’
Code: -

Output (CSV File): -


Question – 14
The student table of test database of MySQL stores student details as RollNO, Name, Marks, Grade.
Write a program to load only rows of this Student table where marks > 80 in a dataframe namely mdf.
Code: -

Output: -
Question – 15
Naman is doing some research. He has a stored line of Pascal's triangle numbers as ar2 as show
below:-
ar2 = [1, 7, 21, 35, 35, 21, 7, 1]
 He wants to plot the sine (use numpy.sin() ) , cosine (use numpy.cos()) and tangent values
(use numpy.tan() ) for the same array ar2.
 He wants cyan color for sine plot line, red color for cosine plot line, and the black color for
tangent plot line.
Also, the tangent line should be dashed.
Solution
import matplotlib.pyplot as plt
import numpy as np
ar2 = [1, 7, 21, 35, 35, 21, 7, 1]
si = np.sin(ar2)
co = np.cos(ar2)
ta = np.tan(ar2)
plt.plot(ar2, si, 'c', label = 'sin')
plt.plot(ar2, co, 'r', label = 'cos')
plt.plot(ar2, ta, 'k', ls = 'dashed', label = 'tan')
plt.legend(loc = 1)
plt.show()
Output
Question – 16
Write a program to plot a scatter graph taking two random distributions in X1 and Y1 (both with
shape as (250,) having randomly generated integers) and plotted against each other with varying
sizes and varying colors.
Code: -

Output: -
Question – 17
Write a program to plat a bar chart from the marks scored by you and your friends in different
subjects
Code: -

Output: -
Question – 18
DPS school celebrated volunteering week where each section of class XI dedicated a day for
collecting amount for charity being supported by the school. Section A volunteered on Monday, B
on Tuesday, C on Wednesday and so on. There are six sections in Class XI. Amounts collected by
sections A to F are 8000, 12000, 9800, 11200, 15500, 7300
Code: -

Output: -
Question – 19
A survey gathers hegith and weight of 100 participants and recorded the participant's ages:-
ages = [1, 1, 2 , 3 , 5 , 7 , 8 , 9 , 10 , 10, 11, 13, 13, 15, 16, 17, 18, 19, 20, 21, 21, 23, 24, 24, 24, 25,
25, 25, 25, 26, 26, 26, 27, 27, 27, 27, 27, 29, 30, 30, 30, 30, 31, 33, 34, 34, 34, 35, 36, 36, 37, 37, 37,
38, 38, 39, 40, 40, 41, 41, 42, 43, 45, 45, 46, 46, 46, 47, 48, 48, 49, 50, 51, 51, 52, 52, 53, 54, 55, 56,
57, 58, 60, 61, 63, 65, 66, 68, 70, 72, 74, 75, 77, 81, 83, 84, 87, 89, 90, 91]
Write a program to plat a histogram from above data with 20 bins
Code :-

Output :-
Question – 20
Consider a DataFrame mksdf as shown below:
Name Age PreBoardMarks BoardMarks
0 Karan 17 4 25
1 Alex 19 24 94
2 Ani 18 31 57
3 Javed 18 2 62
4 Amrit 17 3 70

Write a program to plot pre-board-marks and board marks from above DataFrame on the same
scatter chart.
Code: -
Output: -
Question – 21

MySQL Queries (20)


*Write a SQL command to create a Database named ‘School’. Also write the command to Create a student
table with the student id, name, and marks as attributes where the student id is the primary key.

*Add columns ‘Mobile’ and ‘Sex’ in the table student.

*Add column ‘Address’ in the table student


*Change the name of column ‘Sex’ to ‘Gender’

*Delete a column ‘Address’ from table Student


*Insert the details of 10 new students in the above table.
*Change the mobile number of any one student

*Display the details of those students which name start with ‘A’

*Write output : SELECT LENGTH(NAME), SUBSTR(NAME, 3,3) FROM STUDENT;


*Write output : SELECT COUNT (DISTINCT GENDER) FROM STUDENT;

*Find the min, max, sum, and average of the marks in a student marks table
*Display the Gender, Minimum marks and Maximum Marks Gender wise.
*Write a SQL query to order the (student ID, marks) table in descending order of the marks.

*Delete the details of a student in the above table.

*Delete the table Student.


*Delete the Database School.
BIBLIOGRAPHY
 www.wikipedia.org
 www.python.org
 www.cbse.nic.in
 IP TEACHER

You might also like