parse_cell

function of dascore.utils.tables source

parse_cell(
    text: str ,
)

Read a cell’s value the way its own text states it.

A CSV has no types, so a value which may be a string, a boolean or a number is decided by what was written. A value which is genuinely a string but looks like one of the others is the one thing this spelling cannot express; that value is authored in YAML, where the types are explicit.

Examples

from dascore.utils.tables import parse_cell
parse_cell("True"), parse_cell("1e3"), parse_cell("1.5"), parse_cell("car")
(True, 1000, 1.5, 'car')