CSV functions#

baskerville.infer_csv(path, data_types=None, null_validator=None, has_headers=True, flexible=False, delimiter=',', escape=None, quote='"', quoting=True, trim=None, terminator='CRLF')#

Infers types from the file in the path given.

Parameters:
Returns:

The inferred Field s.

Return type:

list[Field]

Example

mascots.csv

Name,LOC,Species
Ferris,42,Crab
Corro,7,Urchin
>>> import baskerville 
>>> fields = baskerville.infer_csv("mascots.csv") 
>>> print(baskerville.display_fields(fields)) 
╭──────┬─────────┬─────────╮
│ Name │ LOC     │ Species │
├──────┼─────────┼─────────┤
│ Text │ Integer │ Text    │
│      │ Float   │         │
│      │ Text    │         │
╰──────┴─────────┴─────────╯