read_table

function of dascore.utils.tables source

read_table(
    path: Path ,
    what: str = nothing,
)-> ‘pd.DataFrame’

Read one strict CSV table.

Every cell arrives as text and the caller coerces it, so a column’s meaning is the field’s rather than whatever pandas inferred from the rows it happened to see. Only a truly empty cell is null: an empty cell means unset, and a document which writes NA means the string.

Parameters

Parameter Description
path The CSV file to read.
what What a table with no columns fails to state, for that error message.

Examples

import tempfile
from pathlib import Path
from dascore.utils.tables import read_table
with tempfile.TemporaryDirectory() as folder:
    path = Path(folder) / "coupling.csv"
    _ = path.write_text("group,value\nrail,true\n")
    frame = read_table(path)
list(frame.columns), frame["value"][0]
(['group', 'value'], 'true')