require_columns

function of dascore.utils.tables source

require_columns(
    frame: DataFrame ,
    needed ,
    path: Path ,
)-> ‘None’

Refuse a table which does not carry a column it is read by.

Parameters

Parameter Description
frame The table to check.
needed The column names required; a None is ignored, so a caller may pass
an optional column straight through.
path The file the table was read from, for the error message.

Examples

import pandas as pd
from pathlib import Path
from dascore.utils.tables import require_columns
frame = pd.DataFrame({"sequence": [1]})
require_columns(frame, ["sequence", None], Path("t/x.csv")) is None
True