The retail API is more of a price sheet than a calculator. So, in order to determine retail prices based on an hourly range, you can adjust your code to include a computed column that multiplies the hourly rate by the unit hour.
def build_pricing_table(json_data, df):
for item in json_data['Items']:
meter = item['meterName']
for hours in range(1, 301):
computed_value = hours * item['unitOfMeasure'] * item['retailPrice']
df = df.append({
'SKU': item['armSkuName'],
'Retail Price': item['retailPrice'],
'Unit of Measure': item['unitOfMeasure'],
'Region': item['armRegionName'],
'Meter': meter,
'Product Name': item['productName'],
'Computed Value': computed_value
}, ignore_index=True)
return df
The above code block utilizes a DataFrame rather than table_data
but the principles are the same.