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

Class Xii Informatics Practices

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Class Xii Informatics Practices

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

CLASS XII INFORMATICS PRACTICES

Ex.no.1 CREATE SERIES OF SECTION AND


CONTRIBUTION
03/07/2024

Q1. Python list namely section stores the section


names(‘A’,’B’,’C,’D’) of class12. Another list contri stores the
contribution made by students to charity fund endorsed by the
school. Write a code to create a Series object that stores the
contribution amount as the values and section names as indexes.

AIM:
To create Series object that stores the contribution amount as the
values and section names as indexes.

Program:
import pandas as pd
section = [‘A’ , ‘B’ , ‘C’ , ‘D’]
contri = [6700,5600,5000,5200]
s1 = pd.Series(data = contri , index = section]
print(s1)

Output:
A 6700
B 5600
C 5000
D 5200

Result:
The python code is successfully executed.

Ex.no.2 ARITHMETIC OPERATIONS ON SERIES


CLASS XII INFORMATICS PRACTICES

03/07/2024

Q2. Write a program to create Arithmetic operation on Series.

AIM:
To create Arithmetic operation on Series.

PROGRAM:
import pandas as pd
series1 = pd.Series[(1,2,3,4,5)]
series2 = pd.Series[(6,7,8,9,10)]
series3 = series1 + series2
print(series3)

OUTPUT:
0 7
1 9
2 11
3 13
4 14

RESULT:
The python code is successfully executed.

Ex.no.3 SERIES OBJECT


03/07/2024
CLASS XII INFORMATICS PRACTICES

Q3. Write a program to create a Series object that stores the


initial budget allocated (5000/- each) for the 4 quarters of the
year Qtr1, Qtr2 ,Qtr3 , Qtr4:

AIM:
To create the Series object.

PROGRAM:
import pandas as pd
S1 = pd.Series(5000 , index = [‘Qtr1’ , ‘Qtr2’ , ‘Qtr3’ , ‘Qtr4’])
print(S1)

OUTPUT:
Qtr1 5000
Qtr2 5000
Qtr3 5000
Qtr4 5000

RESULT:
The python code is successfully executed.

Ex.no.4 SERIES OBJECT USING ndarray


03/07/2024

Q4. Write a program to create a series object an ndarray that


has 5 elements in the range 24 to 64.
CLASS XII INFORMATICS PRACTICES

AIM:
To create a series object using ndarray.

PROGRAM:
import pandas as pd
s1 = pd.Series (np.linespace(24,64,5))
print(s1)

OUTPUT:
0 24.0
1 34.0
2 44.0
3 54.0
4 64.0

RESULT:
The python code is successfully executed.

Ex.no.5 Series object using ndarray that is created by tiling


03/07/2024

AIM:
To create ndarray using tiling.
CLASS XII INFORMATICS PRACTICES

PROGRAM:
import pandas as pd
s1 = pd.Series(np.tile([3,5],2))
print(s1)

OUTPUT:
0 3
1 5
2 3
3 5

RESULT:
The python code is successfully executed.

You might also like