0% found this document useful (0 votes)
7 views4 pages

Pract Python Ms

/

Uploaded by

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

Pract Python Ms

/

Uploaded by

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

Practical Examination – XII Informatics Practices 2024-25 Set – 1

Q2. Write the python code for the following (7 Marks)


a) Create Customer.csv file with 5 records. This file should have the following columns
Columns
Cust_Id
Cust_Name
Address
Tot_Purchase2024
b) Read the data into a dataframe.
c) Add a column Tot_Purchase2025 to the data frame cust.
d) Create a Line chart to show the values of column Tot_Purchase2024.
e) Give appropriate title and label to x axis and y axis.

import pandas as pd
import matplotlib.pyplot as plt
cust=pd.read_csv('customer.csv')
print(cust)
plt.plot(cust['Tot_Purchase2024'])
cust['Tot_purchase2025']=[300,400,500,600,700]
plt.ylabel('Y axis')
plt.xlabel('Tot purchase 2024')
plt.title('Customer graph')
plt.show()

Q2. Write the python code for the following (7 Marks)


a) Create a Customer.csv file with a minimum of 5 records. The customer file should have the
following columns
Columns
Cust_Id
Cust_Name
Address
Tot_Purchase2024
b) Read the data into a dataframe.
c) Add a column Tot_Purchase2025 to the data frame cust.
d) Create a Line chart to show the values of column Tot_Purchase2025.
e) Give appropriate title and label to x axis and y axis.

import pandas as pd
import matplotlib.pyplot as plt
cust=pd.read_csv('customer.csv')
print(cust)
plt.plot(cust['Tot_Purchase2024'])
cust['Tot_purchase2025']=[300,400,500,600,700]
plt.ylabel('Y axis')
plt.xlabel('Tot purchase 2025')
plt.title('Customer graph')
plt.show()

Practical Examination – XII Informatics Practices 2024-25 Set – 3

Q.2 Write the python code for the following (7 Marks)

a) Create a result.csv file with a minimum of 5 records. The file should have the following columns
Columns
Year
Percentage
b) Read the data into a dataframe.
c) Add a column class to the dataframe .
d) Create a bar chart in python to display the result of a school for five consecutive years.
e) Give appropriate title and label to x axis and y axis.

import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv('result.csv')
df['class']=[8,9,10,11,12]
print(df)
x=[2021,2022,2023,2024,2025]
plt.bar(x,df['Percentage'])
plt.ylabel('Percentage')
plt.xlabel('Year')
plt.title('Result graph')
plt.show()

Year Percentage class


0 2021 89 8
1 2022 92 9
2 2023 70 10
3 2024 90 11
4 2025 65 12
Practical Examination – XII Informatics Practices 2024-25 Set – 4

Q.2 Write the python code for the following (7 Marks)


a) Create a cricket.csv file with a minimum of 5 records. The file should have the following
columns

Columns
Name
Runs_scored

b) Read the data into a dataframe.


c) Add a column age to the data frame .
d) Create a bar chart in python to display the runs scored by five different cricketers.
e) Give appropriate title and label to x axis and y axis.

import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv('cricket.csv')
df['age']=[45,40,39,38,32]
print(df)

plt.bar(df['Name'],df['Runs_scored'])
plt.ylabel('Runs')
plt.xlabel('Name')
plt.title('Cricket graph')
plt.show()

Name Runs_scored age


0 Dhoni 100 45
1 Virat 90 40
2 Jadeja 80 39
3 Rohit 70 38
4 Shreyas 77 32

You might also like