Data Handling using Pandas - I — NCERT Solutions
CBSE · Class 12 · Informatics Practices
NCERT Solutions for Data Handling using Pandas - I, CBSE Class 12 Informatics Practices: 44 textbook questions solved step by step. Covers Exercise.
Interactive on Super Tutor
Studying Data Handling using Pandas - I? Get the full interactive chapter.
Quizzes, flashcards, AI doubt-solver and a step-by-step study plan — built for NCERT solutions and more.
Free trial, no card needed.
The first 22 solutions are open to read. The other 22 are free with a Super Tutor account.
Exercise
1What is a Series and how is it different from a 1-D array, a list and a dictionary?Show solution
A Series is a one-dimensional array in Pandas that stores a sequence of values of any data type and has index labels for each value.
Differences:
- 1-D array (NumPy ndarray): stores elements in a one-dimensional form, but uses only integer positions for indexing.
- List: a general Python collection; it does not provide Pandas-style labeled indexing and built-in data analysis methods.
- Dictionary: stores key:value pairs, while a Series stores values with an index. A Series can be created from a dictionary, but it is not the same thing.
2What is a DataFrame and how is it different from a 2-D array?Show solution
A DataFrame is a two-dimensional labelled data structure like a table. It contains rows and columns, and each column may have a different data type.
Difference from a 2-D array:
- A 2-D array usually stores homogeneous data and is accessed mainly by numeric positions.
- A DataFrame can store different data types in different columns and uses row and column labels for easier access and analysis.
3How are DataFrames related to Series?Show solution
DataFrames are closely related to Series.
- A DataFrame can be thought of as a collection of Series.
- Each column in a DataFrame is a Series.
- When a DataFrame is created from a dictionary of Series, the resulting rows and columns are formed by combining those Series.
4What do you understand by the size of (i) a Series, (ii) a DataFrame?Show solution
The size means the total number of data values.
- For a Series, size = the number of elements in it.
- For a DataFrame, size = the total number of values in all rows and columns, i.e. rows × columns.
5aEngAlph, having 26 elements with the alphabets as values and default index values.Show solution
import pandas as pd
EngAlph = pd.Series(list('abcdefghijklmnopqrstuvwxyz'))
print(EngAlph)5bVowels, having 5 elements with index labels 'a', 'e', 'i', 'o' and 'u' and all the five values set to zero. Check if it is an empty series.Show solution
import pandas as pd
Vowels = pd.Series([0, 0, 0, 0, 0], index=['a', 'e', 'i', 'o', 'u'])
print(Vowels)
print(Vowels.empty)Vowels.empty will be False because the Series has 5 values, so it is not empty.
5cFriends, from a dictionary having roll numbers of five of your friends as data and their first name as keys.Show solution
import pandas as pd
Friends = pd.Series({'Aman': 12, 'Riya': 15, 'Kunal': 8, 'Meena': 20, 'Tarun': 11})
print(Friends)The dictionary keys become the index labels of the Series.
5dMTseries, an empty Series. Check if it is an empty series.Show solution
import pandas as pd
MTseries = pd.Series()
print(MTseries)
print(MTseries.empty)MTseries.empty will be True because the Series has no values, so it is an empty Series.
5eMonthDays, from a numpy array having the number of days in the 12 months of a year. The labels should be the month numbers from 1 to 12.Show solution
import pandas as pd
import numpy as np
MonthDays = pd.Series(np.array([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]), index=range(1, 13))
print(MonthDays)6aSet all the values of Vowels to 10 and display the Series.Show solution
Vowels[:] = 10
print(Vowels)This sets all values in the Series to 10.
6bDivide all values of Vowels by 2 and display the Series.Show solution
Vowels = Vowels / 2
print(Vowels)Since all values of Vowels are 10 after the previous step, dividing by 2 gives 5 in each position.
6cCreate another series Vowels1 having 5 elements with index labels 'a', 'e', 'i', 'o' and 'u' having values [2,5,6,3,8] respectively.Show solution
Vowels1 = pd.Series([2, 5, 6, 3, 8], index=['a', 'e', 'i', 'o', 'u'])
print(Vowels1)6dAdd Vowels and Vowels1 and assign the result to Vowels3.Show solution
Vowels3 = Vowels + Vowels1
print(Vowels3)This adds the two Series after matching their index labels and stores the result in Vowels3.
6eSubtract, Multiply and Divide Vowels by Vowels1.Show solution
Vowels - Vowels1
Vowels * Vowels1
Vowels / Vowels1These are the commands for subtraction, multiplication and division of Vowels by Vowels1.
6fAlter the labels of Vowels1 to ['A', 'E', 'I', 'O', 'U'].Show solution
Vowels1.index = ['A', 'E', 'I', 'O', 'U']
print(Vowels1)This changes the index labels of Vowels1 to the given uppercase labels.
7aFind the dimensions, size and values of the Series EngAlph, Vowels, Friends, MTseries, MonthDays.Show solution
Use the index, size, and values attributes for each Series.
EngAlph.ndim, EngAlph.size, EngAlph.values
Vowels.ndim, Vowels.size, Vowels.values
Friends.ndim, Friends.size, Friends.values
MTseries.ndim, MTseries.size, MTseries.values
MonthDays.ndim, MonthDays.size, MonthDays.values7bRename the Series MTseries as SeriesEmpty.Show solution
MTseries.name = 'SeriesEmpty'
print(MTseries)This assigns the Series name SeriesEmpty.
7cName the index of the Series MonthDays as monthno and that of Series Friends as Fname.Show solution
MonthDays.index.name = 'monthno'
Friends.index.name = 'Fname'This names the index of MonthDays as monthno and that of Friends as Fname.
7dDisplay the 3rd and 2nd value of the Series Friends, in that order.Show solution
Use positional indexing. Since the 3rd and 2nd values are at positions 2 and 1:
Friends[[2, 1]]7eDisplay the alphabets 'e' to 'p' from the Series EngAlph.Show solution
To display alphabets from 'e' to 'p', use label slicing:
EngAlph['e':'p']In label slicing, the end label is included.
7fDisplay the first 10 values in the Series EngAlph.Show solution
Use head() to get the first 10 values:
EngAlph.head(10)7gDisplay the last 10 values in the Series EngAlph.Show solution
Use tail() to get the last 10 values:
EngAlph.tail(10)Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
Free with a Super Tutor account
22 more solved questions in Data Handling using Pandas - I
They are free with a Super Tutor account, along with practice quizzes and flashcards for this chapter. Free to start, no card needed.
Frequently Asked Questions
What are the important topics in Data Handling using Pandas - I for CBSE Class 12 Informatics Practices?
Are these NCERT Solutions for Data Handling using Pandas - I free?
How should I revise Data Handling using Pandas - I for the CBSE Class 12 board exam?
Sources & Official References
- NCERT Official — ncert.nic.in
- CBSE Academic — cbseacademic.nic.in
- CBSE Official — cbse.gov.in
- National Education Policy 2020 — education.gov.in
Content is aligned to the official syllabus. Refer to the board website for the latest curriculum.
More resources for Data Handling using Pandas - I
Practice Quiz
Test yourself with a quick quiz
Important Questions
Exam-style questions with answers
Revision Notes
Key points for last-minute revision
Formula Sheet
The chapter's formulas in one place
Chapter Summary
Understand the chapter at a glance
Concept Maps
See how topics connect
Study Plan
Step-by-step plan for this chapter
Flashcards
Quick-fire cards for active recall
Syllabus
What topics to cover
For serious students
Get the full Data Handling using Pandas - I chapter — start free.
Quizzes, flashcards, an AI doubt solver and a study plan for CBSE Class 12 Informatics Practices. Free to start, no card needed.