← Computational Mathematical Biology

Pandas

Pandas is used for labelled tabular data such as biological observations collected by date, location, treatment or individual.

Reading data

import pandas as pd

data = pd.read_csv("observations.csv")
print(data.head())

Selecting variables

time = data["time"]
cases = data["cases"]

Basic checks

print(data.isna().sum())
print(data.describe())

Data cleaning should be scientifically documented: missing values, aggregation and transformations can change the meaning of the analysis.

Key idea. Pandas helps organise observed data before they are visualised, statistically analysed or compared with mathematical models.