You are on page 1of 6

Holidays

homework

Name- Arshpreet Singh


Standard-XII D
Roll No.-
Subject- Informatic Practices
Sub. Teacher-Mrs.Kajal
H.O.D.-Mrs.Kajal
What is python?
Python is a high-level, interpreted
programming language that is widely used
for various purposes, including web
development, data analysis, scientific
computing, artificial intelligence,
automation, and more. It was created by
Guido van Rossum and first released in
1991. Python emphasizes code readability
and simplicity, making it easy to learn and
write.

Here are some basic features of python:

• Python has a clean and readable syntax.

• It supports both procedural and object-oriented


programming paradigms.

• Python has automatic memory management (garbage


collection).

• It provides extensive standard libraries for various tasks.

• Python is an interpreted language, allowing for interactive


and exploratory programming.

• It has strong support for integration with other languages

Arsh
List of programs :
1. Write code to create a Series object using the Python sequence
(4,6,8,10).Assume that Pandas is imported as alias name pd.

2. Write code to create a Series object using the Python sequence


(11,21,31,41) Assume that Pandas is imported as alias name pd.

3. 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 school.

4. Write a program to create a Series object that stores the initial budget
allocated(50000/each) for the four quarters of year: Qtri,Qtr2,Qtr3,Qt4.

5. Consider the Series object s13 that stores the contribution of each section,
as shown below:

A 6700

B 5600

C 5000

D 5200

6. A series object consists of around 10 rows of data. Write a program to


print First 3 rows of data.

7. Given a dictionary that stores the section names' list as value for 'Section'
key and contribution amounts' list as value for 'Contri' key, Create a
dataframe: Dict1=('Section': ['A', 'B','C','D'], "Contri":
[16700,5600,5000,5200])

8. Write a program create a dataframe from a 2d list.Specify own index


labels. 9. To create a dataframe to store weight, age and names of 3 people.

10. Write a program to create a dataframe from a 2D array as shown below

101 113 124


130 140 200
115 216 217
11. What will be the output of following code? import pandas as pd

import numpy as np
arr1 = np.array([11,12],[13,14],[15,16]].np.int32)

dtf2 = pd.DataFrame(arr1)

print(dtf2)

12. Create a DataFrame namely aid that stores the aid by NGOs for different
states

toys books uniform

Andhra
7916 6189 610
Pradesh

Odisha 8508 8208 508

13. From the above data frame write a program to display the aid for Books and
Uniform only

14. From the above data frame write a program to display the aid for Uniform
only

15. In Question no 12 add a new column named laptop with data 300,400.

16. Create the Following data frame:

Target Sales

Zone A 56000 58000

Zone B 70000 68000

Zone C 75000 78000

17. Consider the saleDf shown above.Write a program to rename indexes of


'zoneC' and 'ZoneD' as 'Central' and 'dakshin' respectively and the column
names 'Target' and 'Achieved' respectively.

18. Consider the saleDf shown above.Write the code to add column names
'Targeted' and 'Achieved' respectively.

19. Write the code to Select the data from zoneC Row.

20. Create a Data frame with Boolean Indexes.


Ques1. Code :

> import pandas as pd


> import numpy as np
> L1=[4,6,8,10]
> s1=pd.Series(L1)
> print(s1)

#output

Ques2. Code :

> import pandas as pd


> import numpy as np
> L1 (11,21,31,41)
> s1=pd.Series(L1)
> print(s1)

#output

Ques3. Code :

> import pandas as pd


> import numpy as np
> cls12 ={"A":20,"B":30,"C":40}
> s1=pd.Series(cls12)
> print(s1)
#output

Ques4. Code :

> import pandas as pd


> import numpy as np
>year=
{"qtr1":50000,"qtr2":50000,"qtr3":50000,"qtr4":50000}
> s1=pd.Series(year)
> print(s1)

#output

Ques5. Code :

> import pandas as pd


> import numpy as np
> s13={"A":6700,"B":5600,"C":5000,"D":5200}
> s1=pd.Series(s13)
> print(s1)

#output

You might also like