In this article, you will get important QnA Pandas Series IP Class 12. For all of these questions, consider that Pandas and NumPy modules have been imported as:
import pandas as pd
import numpy as np
QnA Pandas Series IP Class 12 – Output Questions
1. Consider the following series object Named ‘Ser’:
What will be output of following statements?:
i) print(ser.index) ii) print(ser.value) iii) print(ser.shape) iv) print(ser.size) v) print(ser)
vi) ser= 999 vii) print(ser[2:])
print(ser) print(ser[: :-1]
2. fruits = [‘Apple’,’Mango’, ‘Banana’, ‘Grapes’]
r2019 = pd.Series([100,80,30,60], index = fruits)
r2020 = pd.Series([150,100,50,80], index = fruits)
print (r2020 – r2019)
r2020 = r2019 + 100
3. ser = pd.Series([5987,5634,3450,2500,1500,7899,6432,8756,9123,4400])
print(ser==1500 or ser==1500)
for i in range(1,11,2):
5. ser = pd.Series(range(1,10))
In the next section of QnA Pandas Series IP Class 12 we will see error-based questions:
1. ser = pd.series(range(4))
2. ser = pd.Series(11,22,33,55, index = range(3))
3. l = np.array([‘C’,’C++’,’Java’,’Python’])
s = pd.Series(l,index=[501,502,503,504])
4. ser = pd.Series(range(1,12,2),index=list(‘pqrst’))
The next section of QnA Pandas Series IP Class 12 is based on Conceptual Questions, have a look:
- What is pandas? Explain in detail.
- List out common data structure supported by Pandas.
- How to use pandas in the library in a program? Illustrate the answer with an example.
- What are the differences between series, ndarrays and lists? Explain with example.
- What is a panda series? Explain with a suitable example.
- How to create an empty series? Explain with a suitable example.
- How to create a series with the following, illustrate answer with an example: A python sequence, NumPy Array, A dictionary, A scalar value
- Explain the attributes of the series object with an example.
- Name the function that displays the top and bottom elements of a series. Explain with example.
- What is the use of the drop() and reindex() method? Explain with example.
In the next section of QnA Pandas Series IP Class 12, do practice for program based questions:
1. Write a program to store a population of 4 cities with an index of the previous 4 years. Write functions to do the following:
i) Print the average population of the year 2019 and 2018.
ii) Print the grand total of all cities population.
iii) Print the highest population of each city.
iv) Print the difference between the first year and last year.
v) Delete entry of one year from the series.
2. Write a program to store employees salary data for one year. Write functions to do the following:
i) Display salary data by slicing it into 4 parts.
ii) Display salary of any one month.
iii) Apply increment of 10% into salary for all values.
iv) Give 2400 arrear to employees in April month.
3. Write a program to do the following:
i) Create an empty series.
ii) Modify the series with scalar value 75.
For more practice questions click here:
Click here to access all the contents of IP class 12: