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
Detailed formatcheck.py documentation
echang97 edited this page Jun 26, 2019
·
23 revisions
Parameter(s):
- key - Item to be added or modified
- value - Unit of measurement to be associated with key
- dictionary - The Dictionary that this is being applied to
If key is already in the dictionary, add the value to the set associated with the key
Otherwise, add the associate the new key with a new set containing only value
[Ex 1.] key = "Gas", value = "mcf" -> { "Gas": {"mcf"} }
[Ex 2.] key = "Geothermal - Electrical Generation", value = "Kilowatt Hours" -> { "Geothermal - Electrical Generation": {"Kilowatt Hours"} }
key = "Geothermal - Electrical Generation", value = "Thousands of Pounds" -> { "Geothermal - Electrical Generation": {"Kilowatt Hours", "Thousands of Pounds"} }
Parameter(s):
- cols - Columns from Pandas DataFrame Checks cols for "Commodity" or "Product"
Returns "n/a" if "Commodity" and "Product" are both present or both missing
Otherwise it returns whichever is present ''' [Ex 1.] cols = ["Commodity"] -> returns "Commodity" [Ex 2.] cols = ["Product"] -> returns "Product" [Ex 3.] cols = ["Commodity", "Product"] -> returns "n/a" '''