HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Python Programming
  2. /Python for Science and Maths
  3. /Data Analysis with pandas

Data Analysis with pandas

Python Programming · High School (11–12) · 2 courses, 20 worked problems, 30 practice questions

The pandas library works with tables of data. Its main object is the DataFrame, which has named columns and numbered rows, like a spreadsheet. You can read a CSV file with pd.read_csv(), look at the first rows with .head() and pick a column by its name. You can filter rows, such as all planets heavier than the Earth, and sort them. Methods such as .mean(), .describe() and .groupby() summarise the data in a line or two, and two tables can be merged on a shared column. Scientists use pandas to clean and study results.

With practice you will be able to

  • Load a CSV file into a DataFrame and look at its rows
  • Filter and sort the rows of a table by a condition
  • Summarise columns with .mean(), .describe() and .groupby()

On the syllabus of

  • CBSE / State Class 12

Lessons

  • The Periodic Table as DataWhich elements break the rising trend across a period? How does the radius change?High School (11–12)
  • Data Analysis with pandasCan a table of the planets predict the year of Neptune?High School (11–12)

Practice questions

Choose an answer, then check it. Each one shows a full explanation.

Three elements of period 5 are in a table. What does this print? import pandas as pd; df = pd.DataFrame({"sym": ["Sr", "Ba", "Cd"], "ie": [549, 503, 868]}); print(df["ie"].max())

The same table is sorted. What does this print? import pandas as pd; df = pd.DataFrame({"sym": ["Sr", "Ba", "Cd"], "ie": [549, 503, 868]}); print(list(df.sort_values("ie")["sym"]))

A table has the columns sym and ie. What does df["IE"] do?

A filter is applied to the strontium table. What does this print? import pandas as pd; df = pd.DataFrame({"sym": ["Sr", "Ba", "Cd"], "ie": [549, 503, 868]}); print(len(df[df["ie"] > 540]))

A computed column compares each element with the lowest. What does this print? import pandas as pd; df = pd.DataFrame({"sym": ["Sr", "Ba", "Cd"], "ie": [549, 503, 868]}); df["ratio"] = df["ie"] / df["ie"].min(); print(round(df["ratio"].iloc[0], 2))

Which line keeps the s-block rows whose ie is above 450450450 kJ/mol?

Which graph shows the first ionisation enthalpy of the first ten elements against Z?

Strontium, barium and iodine are grouped by block. What does this print? import pandas as pd; df = pd.DataFrame({"block": ["s", "s", "p"], "ie": [549, 503, 1008]}); print(df.groupby("block")["ie"].mean()["s"])

Rubidium, strontium, indium and tin, in order of Z. What does this print? import pandas as pd; s = pd.Series([403, 549, 558, 709]); print(list(s.diff().dropna().astype(int)))

Across the first 36 elements, what is the sign of the correlation between atomic radius and first ionisation enthalpy?

All 30 practice questions on Data Analysis with pandas →

Worked problems

Each one has a hint, the key idea and a full worked solution.

  • Of the first 36 elements, the halogens are fluorine (64 pm), chlorine (99 pm) and bromine (114 pm)…Easy
  • The first ionisation enthalpies of lithium, sodium and potassium are 520, 496 and 419 kJ/mol…Medium
  • A table indexed by symbol is t = df.set_index("symbol")…Easy
  • Ravi's program builds the table with the column names symbol, z, group, period, block, radius, ie…Medium
  • Rina plots the first ionisation enthalpy against Z for the first 20 elements…Easy
  • Across period 3, the atomic radii from sodium to chlorine are 186, 160, 143, 117, 110, 104 and 99…Medium
  • A scatter plot of the first 36 elements colours each point by block with df["block"].map(colours)…Easy
  • Period 2 has two s-block elements, lithium (520) and beryllium (899), and six p-block elements…Medium
  • For lithium to fluorine, the radii are 152, 111, 88, 77, 74, 66 and 64 pm, and the first ionisation…Medium
  • From gallium to krypton the first ionisation enthalpies are 579, 762, 947, 941, 1140 and 1351…Hard
  • Make a table of the four rocky planets with the columns name, distance_au (0.39, 0.72, 1.00, 1.52)…Easy
  • A sensor wrote the readings 9.8, 9.7, -999 and 9.9…Medium

All 20 worked problems on Data Analysis with pandas →

Python labs

  • Filtering the elements
  • Where the rise breaks
  • A planet table in pandas
  • Clean the table
  • New columns
  • Group and join

Related topics

  • Python for Science and Maths
  • NumPy Arrays
  • Graphs with matplotlib
  • Solving Equations
  • Calculus by Computer
  • Simulation and Randomness
  • Chemistry by Computer
  • Biology by Computer
  • Trigonometry and Waves by Computer