Skip to main content

← Back to Python Course Foundations

NumPy and Pandas Basics

Learning Objectives

  • Compute mean, median, standard deviation, and variance using NumPy.
  • Create DataFrames from list and dictionary.
  • Access rows/columns with loc and iloc.

Example

import numpy as np
import pandas as pd

arr = np.array([72, 85, 90, 68, 85])
print(np.mean(arr), np.median(arr), np.std(arr), np.var(arr))

data = {"name": ["Asha", "Ravi"], "marks": [88, 92]}
df = pd.DataFrame(data)
print(df.loc[0])
print(df.iloc[:, 1])

Dry Run

  • NumPy computes numeric summaries quickly.
  • loc uses labels, iloc uses positions.

Common Mistakes

  • Mixing label index and integer index in selection.
  • Forgetting to install/import required libraries.

Practice

  1. Read a CSV and print top 5 rows.
  2. Filter students with marks > 80.

📍 Visit Us

🏫 VD Computer Tuition Surat

VD Computer Tuition
📍 Address
2/66 Faram Street, Rustompura
Surat395002, Gujarat, India
📞 Phone / WhatsApp
+91 84604 41384
🌐 Website

Computer Classes & Tuition — Areas We Serve in Surat

AdajanAlthanAmroliAthwaAthwalinesBhagalBhatarBhestanCanal RoadChowkCitylightDumasGaurav PathGhod Dod RoadHaziraJahangirpuraKamrejKapodraKatargamLimbayatMagdallaMajura GateMota VarachhaNanpuraNew CitylightOlpadPalPandesaraParle PointPiplodPunaRanderRing RoadRustampuraSachinSalabatpuraSarthanaSosyo CircleUdhnaVarachhaVed RoadVesuVIP Road
📞 Call Sir💬 WhatsApp Sir