Module 10

Filtering biological data

Selecting rows that meet a condition.

Selecting rows

You can filter a DataFrame to keep only the rows that meet a condition.

PythonFiltering for GC > 50.
import pandas as pd
df = pd.DataFrame({"gene": ["A", "B", "C"], "gc": [54, 48, 60]})
high_gc = df[df["gc"] > 50]
print(high_gc)
Your task

Filter data

  • Filter for rows where gc > 50.