-
Notifications
You must be signed in to change notification settings - Fork 2
formatcheck.py documentation
echang97 edited this page Jul 31, 2019
·
11 revisions
Function Name | Description |
---|---|
add_item(key,value,dictionary) | Adds value to the List corresponding to key |
get_com_pro(col) | Returns a String depending on if "Product", "Commodity", or neither are present in col |
get_prefix(name) | Returns a String determined by keywords in name |
split_unit(string) | Returns a List, splitting Item and Unit |
Dependencies: Pandas
Keyword Arguments:
file -- A Pandas DataFrame
type -- Prefix for the config file, derived from sample file name
class Setup(file):
Returns a Setup object with __slots__=[file]
Method Name | Description |
---|---|
get_header(file) | Returns a List of Columns based on given DataFrame |
get_unit_dict(file) | Returns a Dictionary mapping of Items and Units |
get_misc_cols(file) | Returns a Dictionary mapping of Fields and Expected Values |
make_config_path() | Creates a new folder "config" if not present in current working directory |
write_config(type) | Writes a json file based on given DataFrame |
Dependencies: Pandas
Keyword Arguments:
file -- A Pandas DataFrame
type -- Prefix for the config file, derived from sample file name
class FormatChecker(type):
Returns a FormatChecker with a json-based dictionary
Method Name | Description |
---|---|
do_check(df, prefix, pathname) | Calls all check methods. Exports Results |
get_w_count(df) | Returns number of W's found for Volume and Location |
check_header(df) | Checks header for Order and missing or unexpected field names |
check_misc_cols(df) | Checks non-numerical columns for Unexpected Values |
check_nan(df) | Checks if specific columns are missing values |
check_unit_dict(df) | Checks commodities/products for New items or Unexpected units of measurement |
read_config(prefix) | Returns an decoded json object |