This repository was archived by the owner on Mar 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
formatcheck.py documentation
echang97 edited this page Jul 11, 2019
·
11 revisions
| Function Name | Description |
|---|---|
| add_item(key,value,dictionary) | Adds value to the Set corresponding to key |
| get_com_pro(col) | Returns a String depending on if "Product", "Commodity" or both are present in col |
| get_data_type(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 |
| set_file(file) | Sets variables based on given DataFrame |
| 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 Setup object based on type
| Method Name | Description |
|---|---|
| get_w_count(file) | Returns number of W's found for Volume and Location |
| check_header(file) | Checks header for Order and missing or unexpected field names |
| check_misc_cols(file) | Checks non-numerical columns for Unexpected Values |
| check_nan(file) | Checks if specific columns are missing values |
| check_unit_dict(file) | Checks commodities/products for New items or Unexpected units of measurement |
| read_config(type) | Returns an decoded json object |
Dependencies: Pandas
Keyword Arguements:
file -- A Pandas DataFrame
sd -- Number of Standard Deviations
| Method Name | Description |
|---|---|
| check_sd(file, sd) | Goes through Rev/Vol and prints out values outside of SD |
| check_threshold(file, min, max) | Goes through Rev/Vol and prints out values outside of range (min-max) |