← 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
locandiloc.
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.
locuses labels,ilocuses positions.
Common Mistakes¶
- Mixing label index and integer index in selection.
- Forgetting to install/import required libraries.
Practice¶
- Read a CSV and print top 5 rows.
- Filter students with marks > 80.