import pandas as pd
# Pricing Plan
requests_included = 10_000_000
request_overage_cost = 0.30
cpu_time_included = 30_000_000
cpu_time_overage_cost = 0.02
# Your Usage
daily_requests = 7_860_000
cpu_time_per_request = 3293.4
# Monthly Calculations
monthly_requests = daily_requests * 30 # Assuming 30 days in a month
monthly_cpu_time = monthly_requests * cpu_time_per_request
requests_overage = max(0, monthly_requests - requests_included)
cpu_time_overage = max(0, monthly_cpu_time - cpu_time_included)
request_overage_cost_total = requests_overage * request_overage_cost / 1_000_000
cpu_time_overage_cost_total = cpu_time_overage * cpu_time_overage_cost / 1_000_000
total_monthly_cost = request_overage_cost_total + cpu_time_overage_cost_total
# Daily Average Cost
daily_average_cost = total_monthly_cost / 30
# Display results in a DataFrame for better readability
results_df = pd.DataFrame({
'Metric': ['Monthly Requests', 'Monthly CPU Time', 'Requests Overage', 'CPU Time Overage',
'Request Overage Cost', 'CPU Time Overage Cost', 'Total Monthly Cost', 'Daily Average Cost'],
'Value': [f"{monthly_requests:,.0f}", f"{monthly_cpu_time:,.0f}", f"{requests_overage:,.0f}",
f"{cpu_time_overage:,.0f}", f"${request_overage_cost_total:,.2f}", f"${cpu_time_overage_cost_total:,.2f}",
f"${total_monthly_cost:,.2f}", f"${daily_average_cost:,.2f}"]
})
print(results_df)
// Output
Metric Value
0 Monthly Requests 235,800,000
1 Monthly CPU Time 776,583,720,000
2 Requests Overage 225,800,000
3 CPU Time Overage 776,553,720,000
4 Request Overage Cost $67.74
5 CPU Time Overage Cost $15,531.07
6 Total Monthly Cost $15,598.81
7 Daily Average Cost $519.96