"""Create and manipulate an emzed table."""

import emzed

peaks = emzed.Table.create_table(
    ["compound", "mz", "rt", "area"],
    [str, emzed.MzType, emzed.RtType, float],
    rows=[
        ["caffeine", 195.08765, 42.0, 2.4e6],
        ["glucose", 181.07066, 60.0, 8.1e5],
        ["arginine", 175.11895, 95.0, 1.2e6],
    ],
)

peaks.add_column("area_million", peaks.area / 1e6, float)

late_peaks = peaks.filter(peaks.rt > 50.0)
summary = late_peaks.extract_columns("compound", "mz", "rt", "area_million")

print(summary)
