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 18, 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 |
|---|---|
| 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) |