energy = {}
data_source_rank = {} // overwrite Power with Energy with Energy(cumulative)
for (physical_quantity, ac_type), series in df.iteritems():
if physical_quantity == "power":
// Preference is to calculate energy from
// native Energy data rather than Power data
After Change
// Select a column based on ordered preferences
PHYSICAL_QUANTITY_PREFS = ["cumulative energy", "energy", "power"]
selected_columns = []
for ac_type in AC_TYPES:
physical_quantities = [physical_quantity
for (physical_quantity, col_ac_type) in df.keys()
if col_ac_type == ac_type]