April 27, 2026

Introduction to Pandas (Pharma Data Analysis & Why Pandas over CSV/NumPy)

Introduction to Pandas for Pharmacy Students (Pharma Data Analysis & Why Pandas Over CSV/NumPy)

Pandas is one of the most powerful Python libraries used for data analysis. In pharmaceutical sciences, it plays a crucial role in handling patient datasets, pharmacokinetic (PK) studies, and ADR reports.


๐Ÿ”ท What is Pandas?

Pandas is a Python library used for data manipulation and analysis. It provides easy-to-use data structures and functions for working with structured data.

๐Ÿ’ก Key Insight: Pandas converts raw healthcare data into meaningful clinical insights.

๐Ÿ”ท Importing Pandas

import pandas as pd

๐Ÿ”ท Why Pandas in Pharmacy?

  • Handles large datasets efficiently
  • Supports CSV and Excel files
  • Provides statistical analysis tools
  • Useful for PK and ADR data analysis

๐Ÿ’Š Pharma Dataset Example

PatientDrugDoseReaction
P001Aspirin500Mild
P002Ibuprofen650Severe

Pandas helps analyze such datasets easily.


๐Ÿ”ท Why Pandas Over CSV Module?

FeatureCSV ModulePandas
Ease of useLowHigh
Data analysisLimitedAdvanced
FilteringManualBuilt-in

๐Ÿ”ท Why Pandas Over NumPy?

FeatureNumPyPandas
Data TypeArraysTables
Labelled DataNoYes
Real-world DataLimitedExcellent

๐Ÿ”ท Simple Pandas Example

import pandas as pd

data = {
    "Patient": ["P001", "P002"],
    "Dose": [500, 650]
}

df = pd.DataFrame(data)
print(df)

๐Ÿง  Memory Tricks

  • Pandas โ†’ Data analysis
  • DataFrame โ†’ Table
  • Series โ†’ Column

๐Ÿงช Practice Exercise

Create a dataset using Pandas:

  • Store patient names
  • Store doses
  • Display data

๐Ÿงช Mini Project

Create a simple patient dataset:

import pandas as pd

data = {
    "Name": ["Alice", "Bob"],
    "Dose": [500, 700]
}

df = pd.DataFrame(data)
print(df)

๐Ÿ“ MCQs

  1. Pandas is used for:
    a) Gaming
    b) Data analysis
    c) Networking
    d) Drawing
    Answer: b

  2. DataFrame represents:
    a) List
    b) Table
    c) String
    d) Loop
    Answer: b

  3. Which is better for dataset analysis?
    a) CSV
    b) NumPy
    c) Pandas
    d) None
    Answer: c

โ“ FAQs

Why is Pandas important in pharmacy?

It helps in analyzing clinical, PK, and ADR datasets efficiently.

Can Pandas replace NumPy?

Pandas is built on NumPy, but it is more user-friendly for data analysis.


๐Ÿ“ฅ Download Pharma Dataset for Practice

Start analyzing real patient and ADR data.


โžก Next Topic: Pandas Series & DataFrame โ†’

Recommended readings

  1. Introduction to Pandas (Why it is used in Pharma Data Analysis)
  2. Pandas Series & DataFrame (with patient & PK datasets)
  3. Reading CSV & Excel Files (PK datasets, ADR reports)
  4. Inspecting Data (head(), tail(), info(), describe())
  5. Data Cleaning & Missing Values (real clinical dataset problems)
  6. Filtering & Selecting Data (high dose, ADR filtering)
  7. Grouping & Aggregation (mean dose, ADR frequency)

Question Bank Unit 4: Data Handling with Pandas

For detailed information: Basics of Python Programming for Pharmaceutical Sciences