Data Handling using Pandas - II
Class 12 · Informatics Practices
4 ideas in Class 12 Informatics Practices, explained in plain words, with games and quizzes to practise.
Reading Column Statistics
Part of: Summarising Columns
One method call collapses a column into a single number: the highest Maths score is 24, the total is 84, the mean Science score is 21.25. By default the summary runs down each column, and asking across rows totals each student instead.
Why it matters. Toppers, totals and averages answer the first question anyone asks about marks. Reading them straight from the table keeps reports honest.
Key words
- Maximum
- : The largest value found in a column.
- Mean
- : The total shared equally among all values.
- Aggregation
- : Turning many values into one summary number.
- Axis
- : Chooses columns with 0 and rows with 1 for summaries.
Try it in two minutes
- List four Maths scores and circle the highest and lowest together.
- Add the four scores and divide by four for the mean.
- Total the two subjects of the first student to show row-wise sums.
- Sort three names alphabetically to show how text maximum works.
Try at home. Take five spelling scores, find the highest, lowest, total and mean without a calculator first, then check.
Middle and Spread of Data
Part of: Summarising Columns
Median is the middle value, mode is the most frequent value, and quartiles cut ordered data into quarters. Variance averages the squared gaps from the mean, and the standard deviation is its square root, so scores 10, 20, 30 have variance 100 and deviation 10.
Why it matters. Two classes can share the same average yet differ wildly. Centre plus spread tells whether marks cluster together or scatter far apart.
Key words
- Median
- : The middle value of ordered data, averaging the two middles when even.
- Mode
- : The value that appears most often.
- Quartile
- : A cut point dividing ordered data into quarters.
- Variance
- : The average of squared gaps from the mean.
- Standard deviation
- : The square root of variance, in the original units.
Try it in two minutes
- Order four scores and average the middle two to show median.
- Vote for favourite fruits and crown the most frequent as mode.
- Measure gaps of 10, 20, 30 from their mean 20.
- Square the gaps and average them to reach variance 100.
Try at home. Take six family ages, find the median and the most common decade, and note the range.
Sorting and Grouping Rows
Part of: Ordering and Labelling Rows
Sorting arranges rows by a column, lowest first or highest first. Grouping splits rows by a category, applies a summary like sum or mean to each group, and combines the answers, so Ami totals 46 and Dev totals 38.
Why it matters. Rank lists need sorting and house-wise totals need grouping. Both turn a flat table into decisions.
Key words
- Sorting
- : Arranging rows in rising or falling order of a column.
- Split
- : Dividing rows into groups by a shared category.
- Apply
- : Running a summary function on each group.
- Combine
- : Lining up the group results into one answer.
Try it in two minutes
- Arrange four score cards from lowest to highest.
- Flip the order to practise descending sorts.
- Pile the cards by student name to show splitting.
- Total each pile and line the totals up to show combining.
Try at home. Sort six coins by value, group them by type, and total each group.
Resetting and Setting the Index
Part of: Ordering and Labelling Rows
Filtering keeps the original row numbers, so picking Dev rows leaves labels 1 and 3. Reset builds a fresh 0, 1 order while storing the old labels in a column, and set promotes a column like Name to become the new labels.
Why it matters. Gappy labels confuse position counting after filtering. A clean index makes the next steps safe.
Key words
- Reset index
- : Builds a fresh continuous index and stores the old one in a column.
- Set index
- : Promotes a column to serve as the row labels.
- Original index
- : The row numbers carried over from before filtering.
Try it in two minutes
- Number four cards 0 to 3 and remove two to show gaps.
- Renumber the survivors 0, 1 and pocket the old numbers.
- Label the survivors by name instead of number.
- Switch back to numbers to show the change reverses.
Try at home. Cross out two lines of a numbered list, then renumber the survivors and note the old numbers aside.
What your child will practise
- Middle and Spread of Data: Desert Quick Fire (Quick Fire)
- Reading Column Statistics: Jungle Puzzle (Clue Puzzle)
- Reading Column Statistics: Space Quick Fire (Quick Fire)
- Resetting and Setting the Index: Ocean Quick Fire (Quick Fire)
- Sorting and Grouping Rows: Desert Puzzle (Clue Puzzle)
- Quiz: Middle and Spread of Data (8 questions)
- Quiz: Reading Column Statistics (8 questions)
- Quiz: Resetting and Setting the Index (8 questions)
- Quiz: Sorting and Grouping Rows (8 questions)