readcsv¶
- emlib.csvtools.readcsv(csvfile, columns=None, asnumber=True, accept_exponential_numbers=False, typeconversions=None, prefer_fractions=False, dialect='excel', first_row_header=True)[source]¶
Read a CSV file into a namedtuple
If the first collumn is all text, assume these are the column names
- Parameters:
columns (
Optional
[list
[str
]]) – a seq of column names, if the first row of data is not a list headerasnumber (
bool
) – convert strings to numbers if they can be convertedtypeconversions (
Optional
[dict
]) – if given, a dict of the form {column:type}accept_exponential_numbers (
bool
) – if True, parse a string 1.5e4 as a numberprefer_fractions (
bool
) – If True, interpret expressions like 3/4 as Fractions, otherwise, as str.
- Return type:
- Returns: