sampotools.api.gen_asd_from_csv¶
-
sampotools.api.
gen_asd_from_csv
(csv_file)¶ Generates an ASD (Attribute Schema Description) object from input SAMPO csv. Since csv files cannot store data type of the input data, this tool decides the attributes’ scale internally using pandas.
It is strongly advised that ASD generated from this tool are checked for correctness. Number values that are intended to be NOMINAL scale may be interpreted as either INTEGER or REAL. Date values that are poorly formatted may be interpreted as NOMINAL. Also, missing values in the csv may cause differences in the expected and actual scales identified by the tool.
These errors are suggested to be manually fixed by the user before being used in SRC.
- Parameters
- csv_filestr
path to csv file.
- Returns
- asd_objectOrderedDict
Attribute schema. See ASD object.
Note
Checking whether the attribute scales and domains are properly generated is strongly recommended.
- Raises
- ValueError
If input CSV file is empty.
If all elements of inputs CSV has no value.
Examples
>>> from sampotools.api import gen_asd_from_csv >>> csv_file = 'sample.csv' >>> asd_object = gen_asd_from_csv(csv_file)