SkyAICampus
HomePracticeLearnCode LabFocus
SkyAICampus
PrivacyTermssupport@skyaicampus.com© 2026 SkyAI Campus
Log inSign up

Learn

HomePracticeConcept cardsCode LabSky Tutor

Review

Revise todayMistake notebookProgress

Focus

Campus ForestFocus roomsSquads

Questions or feedback?
support@skyaicampus.com

  1. 1Series and DataFrames
  2. 2Filtering and sorting
  3. 3GroupBy and aggregation
  4. 4Cleaning data
  5. 5Combining data
← Pandas

Lesson 2 of 5

Filtering and sorting

Watch, read the card, then practise. Filtering rows · loc and iloc · Sorting

Video coming soon

The video for this lesson is being recorded.

Meanwhile, the notes below and the 60-second cards cover the same ideas.

Practise this topic
  • Filtering rows

    Filter rows by putting a condition inside df[...].

    Remember: Condition in brackets, & between them.

  • loc and iloc

    loc picks rows and columns by label; iloc picks them by position.

    Remember: loc = labels. iloc = integer positions.

  • Sorting

    sort_values orders rows by one or more columns.

    Remember: sort_values returns a new table; save it or use it straight away.

Try the example in Code Lab

import pandas as pd
df = pd.DataFrame({"name": ["Asha", "Ravi", "Meena"], "city": ["Pune", "Delhi", "Pune"], "marks": [82, 67, 91]})
print(df[(df["city"] == "Pune") & (df["marks"] > 85)]["name"].tolist())
← Series and DataFramesNext: GroupBy and aggregation →

In this lesson

  • Filtering rows
  • loc and iloc
  • Sorting

Practise this topic

5 questions at your level. The best way to make it stick.

Practise 5 questions