Data Handling with Pandas-BPPS Notes
Class Notes · Free · 41 pages · Basics of Python Programming for Pharmaceutical Sciences · Topic: Data Handling with Pandas
Preview
Summary
These notes cover all of Unit IV: Data Handling with Pandas, written for first-year B.Pharm students and following on from Units I–III. They introduce Pandas and its two data structures, Series and DataFrame. Next they show how to read CSV and Excel files such as PK study datasets and ADR reports. Then they cover inspecting a dataset, data cleaning and handling missing values, and filtering and selecting data. The unit ends with grouping and aggregation using the split–apply–combine idea. Every step is shown on the practice dataset drugs.csv and can be run in the free Pharmakaksha Python Lab or Google Colab. The notes have tables, code panels with output, worked examples, 30 MCQs with an answer key, 20 short-answer questions and 4 long-answer questions with answer plans.
Key points
- Introduction to Pandas: What Pandas is, the Series and DataFrame data structures, and why it is the standard tool for handling tables of pharmaceutical data.
- Reading CSV and Excel files: Loading PK study datasets and ADR reports with read_csv() and read_excel(), creating practice files, and saving results back to a file.
- Inspecting a dataset: head(), tail(), info(), describe(), shape and columns to understand any dataset before analysis, with a worked drugs.csv example.
- Data cleaning and missing values: Finding missing values with isna(), handling them with dropna() and fillna(), and fixing inconsistent text such as differently spelt drug names.
- Filtering, selecting and grouping: Selecting columns, filtering rows with single and multiple conditions, loc vs iloc, and groupby with split–apply–combine to summarise data.
Log in or create a free account to read the full note. More in Notes and the Study Library.