require_stated

function of dascore.utils.tables source

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

Refuse a blank cell in a column the table is read by.

A column which orders or groups the rows decides where each one goes, so a row leaving it empty has no place. Left to pandas the row would simply disappear – a null sorts last, and a null grouping key drops its row from every group.

Parameters

Parameter Description
frame The table to check.
needed The column names which must be stated by every row; a None is
ignored.
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_stated
frame = pd.DataFrame({"sequence": [1, 2]})
require_stated(frame, ["sequence"], Path("t/x.csv")) is None
True