diff --git a/notebooks/experimental/cloud_price_analysis_azure.ipynb b/notebooks/experimental/cloud_price_analysis_azure.ipynb new file mode 100644 index 0000000..eecb291 --- /dev/null +++ b/notebooks/experimental/cloud_price_analysis_azure.ipynb @@ -0,0 +1,2542 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "2c9f7b05", + "metadata": {}, + "source": [ + "### Analysis of Azure Pricing details \n", + "\n", + "This notebook will analyze service name = \"Virtual Machines\"\n", + "source JSON file https://prices.azure.com/api/retail/prices?api-version=2021-10-01-preview&meterRegion=%E2%80%99primary%E2%80%99" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "2c2a399d", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:13.594615Z", + "start_time": "2022-03-30T14:21:12.072308Z" + } + }, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import requests" + ] + }, + { + "cell_type": "markdown", + "id": "0dbffa43", + "metadata": {}, + "source": [ + "#### Access the API end point for Vitual Machine and store JSON file at location ../data/raw/" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "414964d3", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:14.454430Z", + "start_time": "2022-03-30T14:21:13.599343Z" + } + }, + "outputs": [], + "source": [ + "params = {\"filter\": \"serviceName eq Virtual Machines\"}\n", + "r = requests.get(\"https://prices.azure.com/api/retail/prices\", params=params)\n", + "with open(\"../../data/raw/azure_vm.json\", \"w\") as fd:\n", + " fd.write(r.text)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "c5afe6ed", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:14.650696Z", + "start_time": "2022-03-30T14:21:14.465487Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
BillingCurrencyCustomerEntityIdCustomerEntityTypeItemsNextPageLinkCount
0USDDefaultRetail{'currencyCode': 'USD', 'tierMinimumUnits': 0....https://prices.azure.com:443/api/retail/prices...100
1USDDefaultRetail{'currencyCode': 'USD', 'tierMinimumUnits': 0....https://prices.azure.com:443/api/retail/prices...100
2USDDefaultRetail{'currencyCode': 'USD', 'tierMinimumUnits': 0....https://prices.azure.com:443/api/retail/prices...100
3USDDefaultRetail{'currencyCode': 'USD', 'tierMinimumUnits': 0....https://prices.azure.com:443/api/retail/prices...100
4USDDefaultRetail{'currencyCode': 'USD', 'tierMinimumUnits': 0....https://prices.azure.com:443/api/retail/prices...100
\n", + "
" + ], + "text/plain": [ + " BillingCurrency CustomerEntityId CustomerEntityType \\\n", + "0 USD Default Retail \n", + "1 USD Default Retail \n", + "2 USD Default Retail \n", + "3 USD Default Retail \n", + "4 USD Default Retail \n", + "\n", + " Items \\\n", + "0 {'currencyCode': 'USD', 'tierMinimumUnits': 0.... \n", + "1 {'currencyCode': 'USD', 'tierMinimumUnits': 0.... \n", + "2 {'currencyCode': 'USD', 'tierMinimumUnits': 0.... \n", + "3 {'currencyCode': 'USD', 'tierMinimumUnits': 0.... \n", + "4 {'currencyCode': 'USD', 'tierMinimumUnits': 0.... \n", + "\n", + " NextPageLink Count \n", + "0 https://prices.azure.com:443/api/retail/prices... 100 \n", + "1 https://prices.azure.com:443/api/retail/prices... 100 \n", + "2 https://prices.azure.com:443/api/retail/prices... 100 \n", + "3 https://prices.azure.com:443/api/retail/prices... 100 \n", + "4 https://prices.azure.com:443/api/retail/prices... 100 " + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df = pd.read_json(\"../../data/raw/azure_vm.json\")\n", + "df.head()" + ] + }, + { + "cell_type": "markdown", + "id": "0a904b57", + "metadata": {}, + "source": [ + "#### Understand shape of data" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "dc78fb08", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:14.808222Z", + "start_time": "2022-03-30T14:21:14.674502Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Shape of the data\n", + "\n", + " (100, 6)\n", + "\n", + "\n", + "\n", + "Is null?\n", + "\n", + " BillingCurrency 0\n", + "CustomerEntityId 0\n", + "CustomerEntityType 0\n", + "Items 0\n", + "NextPageLink 0\n", + "Count 0\n", + "dtype: int64\n", + "\n", + "\n", + "\n", + "Columnwise Datatype\n", + "\n", + " BillingCurrency object\n", + "CustomerEntityId object\n", + "CustomerEntityType object\n", + "Items object\n", + "NextPageLink object\n", + "Count int64\n", + "dtype: object\n" + ] + }, + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Count
count100.0
mean100.0
std0.0
min100.0
25%100.0
50%100.0
75%100.0
max100.0
\n", + "
" + ], + "text/plain": [ + " Count\n", + "count 100.0\n", + "mean 100.0\n", + "std 0.0\n", + "min 100.0\n", + "25% 100.0\n", + "50% 100.0\n", + "75% 100.0\n", + "max 100.0" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "print(\"Shape of the data\\n\\n\", df.shape)\n", + "print(\"\\n\\n\")\n", + "print(\"Is null?\\n\\n\", df.isnull().sum())\n", + "print(\"\\n\\n\")\n", + "print(\"Columnwise Datatype\\n\\n\", df.dtypes)\n", + "df.describe()" + ] + }, + { + "cell_type": "markdown", + "id": "247a537d", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-22T05:57:27.176179Z", + "start_time": "2022-03-22T05:57:27.170815Z" + } + }, + "source": [ + "#### Split data into multiple components, create series out of dataframes, List \"Items\" is carrying actual data items" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "aa0c94f6", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:16.185057Z", + "start_time": "2022-03-30T14:21:14.814013Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "0 {'currencyCode': 'USD', 'tierMinimumUnits': 0....\n", + "1 {'currencyCode': 'USD', 'tierMinimumUnits': 0....\n", + "2 {'currencyCode': 'USD', 'tierMinimumUnits': 0....\n", + "3 {'currencyCode': 'USD', 'tierMinimumUnits': 0....\n", + "4 {'currencyCode': 'USD', 'tierMinimumUnits': 0....\n", + " ... \n", + "95 {'currencyCode': 'USD', 'tierMinimumUnits': 0....\n", + "96 {'currencyCode': 'USD', 'tierMinimumUnits': 0....\n", + "97 {'currencyCode': 'USD', 'tierMinimumUnits': 0....\n", + "98 {'currencyCode': 'USD', 'tierMinimumUnits': 0....\n", + "99 {'currencyCode': 'USD', 'tierMinimumUnits': 0....\n", + "Name: Items, Length: 100, dtype: object" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df_items = df[\"Items\"]\n", + "df_items = df_items.fillna(\"NA\")\n", + "df_items" + ] + }, + { + "cell_type": "markdown", + "id": "68801327", + "metadata": {}, + "source": [ + "#### Some times JSON file is missing reservationTerm or sometimes carry the values are 1 Year, 3 Years or onDemand\n", + "Below piece of code will determine if reservationTime key exists if not insert key with default value as onDemand" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "565627e5", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:18.103506Z", + "start_time": "2022-03-30T14:21:16.193778Z" + }, + "code_folding": [] + }, + "outputs": [], + "source": [ + "df_items_2 = pd.DataFrame()\n", + "\n", + "for data in df_items:\n", + " df_dictionary = pd.DataFrame([data])\n", + " if \"reservationTerm\" in data:\n", + " df_items_2 = pd.concat([df_items_2, df_dictionary], ignore_index=True)\n", + " else:\n", + " data[\"reservationTerm\"] = \"OnDemand\"\n", + " df_items_2 = pd.concat([df_items_2, df_dictionary], ignore_index=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "2c313b91", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:18.320177Z", + "start_time": "2022-03-30T14:21:18.111715Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
currencyCodetierMinimumUnitsretailPriceunitPricearmRegionNamelocationeffectiveStartDateeffectiveEndDatemeterIdmeterName...productNameskuNameserviceNameserviceIdserviceFamilyunitOfMeasuretypeisPrimaryMeterRegionarmSkuNamereservationTerm
0USD0.00.2627520.262752southindiaIN South2022-03-01T00:00:00Z2022-03-31T23:59:00Z000009d0-057f-5f2b-b7e9-9e26add324a8D14/DS14 Spot...Virtual Machines D Series WindowsD14 SpotVirtual MachinesDZH313Z7MMC8Compute1 HourDevTestConsumptionTrueStandard_D14NA
1USD0.00.5425060.542506southindiaIN South2022-03-01T00:00:00Z2022-03-31T23:59:00Z000009d0-057f-5f2b-b7e9-9e26add324a8D14/DS14 Spot...Virtual Machines D Series WindowsD14 SpotVirtual MachinesDZH313Z7MMC8Compute1 HourConsumptionTrueStandard_D14NA
2USD0.00.8650750.865075eastasiaAP East2022-03-01T00:00:00Z2022-03-31T23:59:00Z00014e7d-fff9-54dd-962e-4e992887ad3cD64s v5 Spot...Virtual Machines Dsv5 Series WindowsStandard_D64s_v5 SpotVirtual MachinesDZH313Z7MMC8Compute1 HourDevTestConsumptionTrueStandard_D64s_v5NA
3USD0.01.4680061.468006eastasiaAP East2022-03-01T00:00:00Z2022-03-31T23:59:00Z00014e7d-fff9-54dd-962e-4e992887ad3cD64s v5 Spot...Virtual Machines Dsv5 Series WindowsStandard_D64s_v5 SpotVirtual MachinesDZH313Z7MMC8Compute1 HourConsumptionTrueStandard_D64s_v5NA
4USD0.010.56000010.560000uksouthUK South2018-11-01T00:00:00ZNA0001d427-82df-4d83-8ab2-b60768527e08E10 Disks...Standard SSD Managed DisksE10 LRSStorageDZH317F1HKN0Storage1/MonthConsumptionTrueNA
..................................................................
95USD0.00.2120000.212000westcentralusUS West Central2021-11-01T00:00:00ZNA00172462-4604-5a25-b1d4-f057577d68e0E4ds v5 Low Priority...Virtual Machines Edsv5 Series WindowsE4ds v5 Low PriorityVirtual MachinesDZH313Z7MMC8Compute1 HourConsumptionTrueStandard_E4ds_v5NA
96USD0.00.0691000.069100westcentralusUS West Central2021-11-01T00:00:00ZNA00172462-4604-5a25-b1d4-f057577d68e0E4-2ds v5 Low Priority...Virtual Machines Edsv5 Series WindowsE4-2ds v5 Low PriorityVirtual MachinesDZH313Z7MMC8Compute1 HourDevTestConsumptionFalseStandard_E4-2ds_v5NA
97USD0.00.2120000.212000westcentralusUS West Central2021-11-01T00:00:00ZNA00172462-4604-5a25-b1d4-f057577d68e0E4-2ds v5 Low Priority...Virtual Machines Edsv5 Series WindowsE4-2ds v5 Low PriorityVirtual MachinesDZH313Z7MMC8Compute1 HourConsumptionFalseStandard_E4-2ds_v5NA
98USD0.00.1814400.181440southindiaIN South2022-03-01T00:00:00Z2022-03-31T23:59:00Z001752ab-2e87-599e-8fac-f1ada637ca61D5 v2/DS5 v2 Spot...Virtual Machines Dv2 SeriesD5 v2 SpotVirtual MachinesDZH313Z7MMC8Compute1 HourConsumptionTrueStandard_D5_v2NA
99USD0.00.4560000.456000canadacentralCA Central2021-10-01T00:00:00ZNA001790af-f893-596a-b4f9-7b0837df43e3DS13 Low Priority...Virtual Machines DS Series WindowsDS13 Low PriorityVirtual MachinesDZH313Z7MMC8Compute1 HourConsumptionFalseStandard_DS13NA
\n", + "

100 rows × 22 columns

\n", + "
" + ], + "text/plain": [ + " currencyCode tierMinimumUnits retailPrice unitPrice armRegionName \\\n", + "0 USD 0.0 0.262752 0.262752 southindia \n", + "1 USD 0.0 0.542506 0.542506 southindia \n", + "2 USD 0.0 0.865075 0.865075 eastasia \n", + "3 USD 0.0 1.468006 1.468006 eastasia \n", + "4 USD 0.0 10.560000 10.560000 uksouth \n", + ".. ... ... ... ... ... \n", + "95 USD 0.0 0.212000 0.212000 westcentralus \n", + "96 USD 0.0 0.069100 0.069100 westcentralus \n", + "97 USD 0.0 0.212000 0.212000 westcentralus \n", + "98 USD 0.0 0.181440 0.181440 southindia \n", + "99 USD 0.0 0.456000 0.456000 canadacentral \n", + "\n", + " location effectiveStartDate effectiveEndDate \\\n", + "0 IN South 2022-03-01T00:00:00Z 2022-03-31T23:59:00Z \n", + "1 IN South 2022-03-01T00:00:00Z 2022-03-31T23:59:00Z \n", + "2 AP East 2022-03-01T00:00:00Z 2022-03-31T23:59:00Z \n", + "3 AP East 2022-03-01T00:00:00Z 2022-03-31T23:59:00Z \n", + "4 UK South 2018-11-01T00:00:00Z NA \n", + ".. ... ... ... \n", + "95 US West Central 2021-11-01T00:00:00Z NA \n", + "96 US West Central 2021-11-01T00:00:00Z NA \n", + "97 US West Central 2021-11-01T00:00:00Z NA \n", + "98 IN South 2022-03-01T00:00:00Z 2022-03-31T23:59:00Z \n", + "99 CA Central 2021-10-01T00:00:00Z NA \n", + "\n", + " meterId meterName ... \\\n", + "0 000009d0-057f-5f2b-b7e9-9e26add324a8 D14/DS14 Spot ... \n", + "1 000009d0-057f-5f2b-b7e9-9e26add324a8 D14/DS14 Spot ... \n", + "2 00014e7d-fff9-54dd-962e-4e992887ad3c D64s v5 Spot ... \n", + "3 00014e7d-fff9-54dd-962e-4e992887ad3c D64s v5 Spot ... \n", + "4 0001d427-82df-4d83-8ab2-b60768527e08 E10 Disks ... \n", + ".. ... ... ... \n", + "95 00172462-4604-5a25-b1d4-f057577d68e0 E4ds v5 Low Priority ... \n", + "96 00172462-4604-5a25-b1d4-f057577d68e0 E4-2ds v5 Low Priority ... \n", + "97 00172462-4604-5a25-b1d4-f057577d68e0 E4-2ds v5 Low Priority ... \n", + "98 001752ab-2e87-599e-8fac-f1ada637ca61 D5 v2/DS5 v2 Spot ... \n", + "99 001790af-f893-596a-b4f9-7b0837df43e3 DS13 Low Priority ... \n", + "\n", + " productName skuName \\\n", + "0 Virtual Machines D Series Windows D14 Spot \n", + "1 Virtual Machines D Series Windows D14 Spot \n", + "2 Virtual Machines Dsv5 Series Windows Standard_D64s_v5 Spot \n", + "3 Virtual Machines Dsv5 Series Windows Standard_D64s_v5 Spot \n", + "4 Standard SSD Managed Disks E10 LRS \n", + ".. ... ... \n", + "95 Virtual Machines Edsv5 Series Windows E4ds v5 Low Priority \n", + "96 Virtual Machines Edsv5 Series Windows E4-2ds v5 Low Priority \n", + "97 Virtual Machines Edsv5 Series Windows E4-2ds v5 Low Priority \n", + "98 Virtual Machines Dv2 Series D5 v2 Spot \n", + "99 Virtual Machines DS Series Windows DS13 Low Priority \n", + "\n", + " serviceName serviceId serviceFamily unitOfMeasure \\\n", + "0 Virtual Machines DZH313Z7MMC8 Compute 1 Hour \n", + "1 Virtual Machines DZH313Z7MMC8 Compute 1 Hour \n", + "2 Virtual Machines DZH313Z7MMC8 Compute 1 Hour \n", + "3 Virtual Machines DZH313Z7MMC8 Compute 1 Hour \n", + "4 Storage DZH317F1HKN0 Storage 1/Month \n", + ".. ... ... ... ... \n", + "95 Virtual Machines DZH313Z7MMC8 Compute 1 Hour \n", + "96 Virtual Machines DZH313Z7MMC8 Compute 1 Hour \n", + "97 Virtual Machines DZH313Z7MMC8 Compute 1 Hour \n", + "98 Virtual Machines DZH313Z7MMC8 Compute 1 Hour \n", + "99 Virtual Machines DZH313Z7MMC8 Compute 1 Hour \n", + "\n", + " type isPrimaryMeterRegion armSkuName \\\n", + "0 DevTestConsumption True Standard_D14 \n", + "1 Consumption True Standard_D14 \n", + "2 DevTestConsumption True Standard_D64s_v5 \n", + "3 Consumption True Standard_D64s_v5 \n", + "4 Consumption True \n", + ".. ... ... ... \n", + "95 Consumption True Standard_E4ds_v5 \n", + "96 DevTestConsumption False Standard_E4-2ds_v5 \n", + "97 Consumption False Standard_E4-2ds_v5 \n", + "98 Consumption True Standard_D5_v2 \n", + "99 Consumption False Standard_DS13 \n", + "\n", + " reservationTerm \n", + "0 NA \n", + "1 NA \n", + "2 NA \n", + "3 NA \n", + "4 NA \n", + ".. ... \n", + "95 NA \n", + "96 NA \n", + "97 NA \n", + "98 NA \n", + "99 NA \n", + "\n", + "[100 rows x 22 columns]" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df_items_2 = df_items_2.fillna(\"NA\")\n", + "df_items_2" + ] + }, + { + "cell_type": "markdown", + "id": "1394fe3d", + "metadata": {}, + "source": [ + "#### Understand unique type, Typical values are Consumption and Reservation" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "b77fef63", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:18.338384Z", + "start_time": "2022-03-30T14:21:18.328828Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['DevTestConsumption' 'Consumption' 'Reservation']\n" + ] + } + ], + "source": [ + "print(pd.unique(df_items_2[\"type\"]))" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "85847f91", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:18.606000Z", + "start_time": "2022-03-30T14:21:18.354050Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['NA' '1 Year' '3 Years']\n" + ] + } + ], + "source": [ + "print(pd.unique(df_items_2[\"reservationTerm\"]))" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "59a84957", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:18.941626Z", + "start_time": "2022-03-30T14:21:18.610847Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
currencyCodetierMinimumUnitsretailPriceunitPricearmRegionNamelocationeffectiveStartDateeffectiveEndDatemeterIdmeterName...productNameskuNameserviceNameserviceIdserviceFamilyunitOfMeasuretypeisPrimaryMeterRegionarmSkuNamereservationTerm
1USD0.00.5425060.542506southindiaIN South2022-03-01T00:00:00Z2022-03-31T23:59:00Z000009d0-057f-5f2b-b7e9-9e26add324a8D14/DS14 Spot...Virtual Machines D Series WindowsD14 SpotVirtual MachinesDZH313Z7MMC8Compute1 HourConsumptionTrueStandard_D14NA
3USD0.01.4680061.468006eastasiaAP East2022-03-01T00:00:00Z2022-03-31T23:59:00Z00014e7d-fff9-54dd-962e-4e992887ad3cD64s v5 Spot...Virtual Machines Dsv5 Series WindowsStandard_D64s_v5 SpotVirtual MachinesDZH313Z7MMC8Compute1 HourConsumptionTrueStandard_D64s_v5NA
4USD0.010.56000010.560000uksouthUK South2018-11-01T00:00:00ZNA0001d427-82df-4d83-8ab2-b60768527e08E10 Disks...Standard SSD Managed DisksE10 LRSStorageDZH317F1HKN0Storage1/MonthConsumptionTrueNA
5USD0.00.1900000.190000uknorthUK North2019-10-16T00:00:00ZNA0001e46a-9285-5fa8-b48a-240e307a24f7A3 Spot...Virtual Machines A Series WindowsA3 SpotVirtual MachinesDZH313Z7MMC8Compute1 HourConsumptionTrueStandard_A3NA
7USD0.00.0756000.075600westusUS West2021-11-01T00:00:00ZNA00026917-5c42-5cf2-994e-4037490635aaE2bds v5 Spot...Virtual Machines Ebdsv5 SeriesStandard_E2bds_v5 SpotVirtual MachinesDZH313Z7MMC8Compute1 HourConsumptionTrueStandard_E2bds_v5NA
..................................................................
91USD0.04.8380004.838000southcentralusUS South Central2020-08-01T00:00:00ZNA0016083a-928f-56fd-8eeb-39287dcf676dE64 v4...Virtual Machines Ev4 SeriesE64 v4Virtual MachinesDZH313Z7MMC8Compute1 HourConsumptionTrueStandard_E64_v4NA
95USD0.00.2120000.212000westcentralusUS West Central2021-11-01T00:00:00ZNA00172462-4604-5a25-b1d4-f057577d68e0E4ds v5 Low Priority...Virtual Machines Edsv5 Series WindowsE4ds v5 Low PriorityVirtual MachinesDZH313Z7MMC8Compute1 HourConsumptionTrueStandard_E4ds_v5NA
97USD0.00.2120000.212000westcentralusUS West Central2021-11-01T00:00:00ZNA00172462-4604-5a25-b1d4-f057577d68e0E4-2ds v5 Low Priority...Virtual Machines Edsv5 Series WindowsE4-2ds v5 Low PriorityVirtual MachinesDZH313Z7MMC8Compute1 HourConsumptionFalseStandard_E4-2ds_v5NA
98USD0.00.1814400.181440southindiaIN South2022-03-01T00:00:00Z2022-03-31T23:59:00Z001752ab-2e87-599e-8fac-f1ada637ca61D5 v2/DS5 v2 Spot...Virtual Machines Dv2 SeriesD5 v2 SpotVirtual MachinesDZH313Z7MMC8Compute1 HourConsumptionTrueStandard_D5_v2NA
99USD0.00.4560000.456000canadacentralCA Central2021-10-01T00:00:00ZNA001790af-f893-596a-b4f9-7b0837df43e3DS13 Low Priority...Virtual Machines DS Series WindowsDS13 Low PriorityVirtual MachinesDZH313Z7MMC8Compute1 HourConsumptionFalseStandard_DS13NA
\n", + "

72 rows × 22 columns

\n", + "
" + ], + "text/plain": [ + " currencyCode tierMinimumUnits retailPrice unitPrice armRegionName \\\n", + "1 USD 0.0 0.542506 0.542506 southindia \n", + "3 USD 0.0 1.468006 1.468006 eastasia \n", + "4 USD 0.0 10.560000 10.560000 uksouth \n", + "5 USD 0.0 0.190000 0.190000 uknorth \n", + "7 USD 0.0 0.075600 0.075600 westus \n", + ".. ... ... ... ... ... \n", + "91 USD 0.0 4.838000 4.838000 southcentralus \n", + "95 USD 0.0 0.212000 0.212000 westcentralus \n", + "97 USD 0.0 0.212000 0.212000 westcentralus \n", + "98 USD 0.0 0.181440 0.181440 southindia \n", + "99 USD 0.0 0.456000 0.456000 canadacentral \n", + "\n", + " location effectiveStartDate effectiveEndDate \\\n", + "1 IN South 2022-03-01T00:00:00Z 2022-03-31T23:59:00Z \n", + "3 AP East 2022-03-01T00:00:00Z 2022-03-31T23:59:00Z \n", + "4 UK South 2018-11-01T00:00:00Z NA \n", + "5 UK North 2019-10-16T00:00:00Z NA \n", + "7 US West 2021-11-01T00:00:00Z NA \n", + ".. ... ... ... \n", + "91 US South Central 2020-08-01T00:00:00Z NA \n", + "95 US West Central 2021-11-01T00:00:00Z NA \n", + "97 US West Central 2021-11-01T00:00:00Z NA \n", + "98 IN South 2022-03-01T00:00:00Z 2022-03-31T23:59:00Z \n", + "99 CA Central 2021-10-01T00:00:00Z NA \n", + "\n", + " meterId meterName ... \\\n", + "1 000009d0-057f-5f2b-b7e9-9e26add324a8 D14/DS14 Spot ... \n", + "3 00014e7d-fff9-54dd-962e-4e992887ad3c D64s v5 Spot ... \n", + "4 0001d427-82df-4d83-8ab2-b60768527e08 E10 Disks ... \n", + "5 0001e46a-9285-5fa8-b48a-240e307a24f7 A3 Spot ... \n", + "7 00026917-5c42-5cf2-994e-4037490635aa E2bds v5 Spot ... \n", + ".. ... ... ... \n", + "91 0016083a-928f-56fd-8eeb-39287dcf676d E64 v4 ... \n", + "95 00172462-4604-5a25-b1d4-f057577d68e0 E4ds v5 Low Priority ... \n", + "97 00172462-4604-5a25-b1d4-f057577d68e0 E4-2ds v5 Low Priority ... \n", + "98 001752ab-2e87-599e-8fac-f1ada637ca61 D5 v2/DS5 v2 Spot ... \n", + "99 001790af-f893-596a-b4f9-7b0837df43e3 DS13 Low Priority ... \n", + "\n", + " productName skuName \\\n", + "1 Virtual Machines D Series Windows D14 Spot \n", + "3 Virtual Machines Dsv5 Series Windows Standard_D64s_v5 Spot \n", + "4 Standard SSD Managed Disks E10 LRS \n", + "5 Virtual Machines A Series Windows A3 Spot \n", + "7 Virtual Machines Ebdsv5 Series Standard_E2bds_v5 Spot \n", + ".. ... ... \n", + "91 Virtual Machines Ev4 Series E64 v4 \n", + "95 Virtual Machines Edsv5 Series Windows E4ds v5 Low Priority \n", + "97 Virtual Machines Edsv5 Series Windows E4-2ds v5 Low Priority \n", + "98 Virtual Machines Dv2 Series D5 v2 Spot \n", + "99 Virtual Machines DS Series Windows DS13 Low Priority \n", + "\n", + " serviceName serviceId serviceFamily unitOfMeasure type \\\n", + "1 Virtual Machines DZH313Z7MMC8 Compute 1 Hour Consumption \n", + "3 Virtual Machines DZH313Z7MMC8 Compute 1 Hour Consumption \n", + "4 Storage DZH317F1HKN0 Storage 1/Month Consumption \n", + "5 Virtual Machines DZH313Z7MMC8 Compute 1 Hour Consumption \n", + "7 Virtual Machines DZH313Z7MMC8 Compute 1 Hour Consumption \n", + ".. ... ... ... ... ... \n", + "91 Virtual Machines DZH313Z7MMC8 Compute 1 Hour Consumption \n", + "95 Virtual Machines DZH313Z7MMC8 Compute 1 Hour Consumption \n", + "97 Virtual Machines DZH313Z7MMC8 Compute 1 Hour Consumption \n", + "98 Virtual Machines DZH313Z7MMC8 Compute 1 Hour Consumption \n", + "99 Virtual Machines DZH313Z7MMC8 Compute 1 Hour Consumption \n", + "\n", + " isPrimaryMeterRegion armSkuName reservationTerm \n", + "1 True Standard_D14 NA \n", + "3 True Standard_D64s_v5 NA \n", + "4 True NA \n", + "5 True Standard_A3 NA \n", + "7 True Standard_E2bds_v5 NA \n", + ".. ... ... ... \n", + "91 True Standard_E64_v4 NA \n", + "95 True Standard_E4ds_v5 NA \n", + "97 False Standard_E4-2ds_v5 NA \n", + "98 True Standard_D5_v2 NA \n", + "99 False Standard_DS13 NA \n", + "\n", + "[72 rows x 22 columns]" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df_consumption = df_items_2.loc[(df_items_2[\"type\"] == \"Consumption\")]\n", + "df_consumption" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "b88a4d4a", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:19.111848Z", + "start_time": "2022-03-30T14:21:18.953010Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
armRegionNameproductNameskuNameretailPricecurrencyCodeserviceNameserviceFamilyreservationTermtype
1southindiaVirtual Machines D Series WindowsD14 Spot0.542506USDVirtual MachinesComputeNAConsumption
3eastasiaVirtual Machines Dsv5 Series WindowsStandard_D64s_v5 Spot1.468006USDVirtual MachinesComputeNAConsumption
4uksouthStandard SSD Managed DisksE10 LRS10.560000USDStorageStorageNAConsumption
5uknorthVirtual Machines A Series WindowsA3 Spot0.190000USDVirtual MachinesComputeNAConsumption
7westusVirtual Machines Ebdsv5 SeriesStandard_E2bds_v5 Spot0.075600USDVirtual MachinesComputeNAConsumption
..............................
91southcentralusVirtual Machines Ev4 SeriesE64 v44.838000USDVirtual MachinesComputeNAConsumption
95westcentralusVirtual Machines Edsv5 Series WindowsE4ds v5 Low Priority0.212000USDVirtual MachinesComputeNAConsumption
97westcentralusVirtual Machines Edsv5 Series WindowsE4-2ds v5 Low Priority0.212000USDVirtual MachinesComputeNAConsumption
98southindiaVirtual Machines Dv2 SeriesD5 v2 Spot0.181440USDVirtual MachinesComputeNAConsumption
99canadacentralVirtual Machines DS Series WindowsDS13 Low Priority0.456000USDVirtual MachinesComputeNAConsumption
\n", + "

72 rows × 9 columns

\n", + "
" + ], + "text/plain": [ + " armRegionName productName \\\n", + "1 southindia Virtual Machines D Series Windows \n", + "3 eastasia Virtual Machines Dsv5 Series Windows \n", + "4 uksouth Standard SSD Managed Disks \n", + "5 uknorth Virtual Machines A Series Windows \n", + "7 westus Virtual Machines Ebdsv5 Series \n", + ".. ... ... \n", + "91 southcentralus Virtual Machines Ev4 Series \n", + "95 westcentralus Virtual Machines Edsv5 Series Windows \n", + "97 westcentralus Virtual Machines Edsv5 Series Windows \n", + "98 southindia Virtual Machines Dv2 Series \n", + "99 canadacentral Virtual Machines DS Series Windows \n", + "\n", + " skuName retailPrice currencyCode serviceName \\\n", + "1 D14 Spot 0.542506 USD Virtual Machines \n", + "3 Standard_D64s_v5 Spot 1.468006 USD Virtual Machines \n", + "4 E10 LRS 10.560000 USD Storage \n", + "5 A3 Spot 0.190000 USD Virtual Machines \n", + "7 Standard_E2bds_v5 Spot 0.075600 USD Virtual Machines \n", + ".. ... ... ... ... \n", + "91 E64 v4 4.838000 USD Virtual Machines \n", + "95 E4ds v5 Low Priority 0.212000 USD Virtual Machines \n", + "97 E4-2ds v5 Low Priority 0.212000 USD Virtual Machines \n", + "98 D5 v2 Spot 0.181440 USD Virtual Machines \n", + "99 DS13 Low Priority 0.456000 USD Virtual Machines \n", + "\n", + " serviceFamily reservationTerm type \n", + "1 Compute NA Consumption \n", + "3 Compute NA Consumption \n", + "4 Storage NA Consumption \n", + "5 Compute NA Consumption \n", + "7 Compute NA Consumption \n", + ".. ... ... ... \n", + "91 Compute NA Consumption \n", + "95 Compute NA Consumption \n", + "97 Compute NA Consumption \n", + "98 Compute NA Consumption \n", + "99 Compute NA Consumption \n", + "\n", + "[72 rows x 9 columns]" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dfi_consumption = df_consumption[\n", + " [\n", + " \"armRegionName\",\n", + " \"productName\",\n", + " \"skuName\",\n", + " \"retailPrice\",\n", + " \"currencyCode\",\n", + " \"serviceName\",\n", + " \"serviceFamily\",\n", + " \"reservationTerm\",\n", + " \"type\",\n", + " ]\n", + "]\n", + "dfi_consumption" + ] + }, + { + "cell_type": "markdown", + "id": "ff60a690", + "metadata": {}, + "source": [ + "#### Group by few columns to get region wise Max Price and Min Price" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "3e8510f9", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:19.321020Z", + "start_time": "2022-03-30T14:21:19.119142Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
maxPriceminPrice
armRegionNameproductNameskuNameserviceNameserviceFamilyreservationTermtype
SQL Server Web Red Hat Enterprise Linux7 vCPU VMVirtual Machines LicensesComputeNAConsumption0.1860000.186000
australiaeastVirtual Machines Esv4 Series WindowsE64-16s v4 SpotVirtual MachinesComputeNAConsumption2.0575302.057530
australiasoutheastVirtual Machines Eadsv5 Series WindowsE16-8ads v5 SpotVirtual MachinesComputeNAConsumption0.5370880.537088
Virtual Machines F Series WindowsF16 SpotVirtual MachinesComputeNAConsumption0.4030240.403024
brazilsouthVirtual Machines A Series BasicA2Virtual MachinesComputeNAConsumption0.1120000.112000
...........................
westindiaVirtual Machines Dv4 SeriesD2 v4 Low PriorityVirtual MachinesComputeNAConsumption0.0236000.023600
westusPremium ADLS Gen2 Hierarchical NamespacePremium ZRSStorageStorageNAConsumption0.1130000.113000
Virtual Machines Ebdsv5 SeriesStandard_E2bds_v5 SpotVirtual MachinesComputeNAConsumption0.0756000.075600
westus2Virtual Machines Ddsv5 SeriesStandard_D64ds_v5Virtual MachinesComputeNAConsumption3.6160003.616000
westus3Azure Redis Cache Enterprise FlashF1500Redis CacheDatabasesNAConsumption10.43000010.430000
\n", + "

67 rows × 2 columns

\n", + "
" + ], + "text/plain": [ + " maxPrice \\\n", + "armRegionName productName skuName serviceName serviceFamily reservationTerm type \n", + " SQL Server Web Red Hat Enterprise Linux 7 vCPU VM Virtual Machines Licenses Compute NA Consumption 0.186000 \n", + "australiaeast Virtual Machines Esv4 Series Windows E64-16s v4 Spot Virtual Machines Compute NA Consumption 2.057530 \n", + "australiasoutheast Virtual Machines Eadsv5 Series Windows E16-8ads v5 Spot Virtual Machines Compute NA Consumption 0.537088 \n", + " Virtual Machines F Series Windows F16 Spot Virtual Machines Compute NA Consumption 0.403024 \n", + "brazilsouth Virtual Machines A Series Basic A2 Virtual Machines Compute NA Consumption 0.112000 \n", + "... ... \n", + "westindia Virtual Machines Dv4 Series D2 v4 Low Priority Virtual Machines Compute NA Consumption 0.023600 \n", + "westus Premium ADLS Gen2 Hierarchical Namespace Premium ZRS Storage Storage NA Consumption 0.113000 \n", + " Virtual Machines Ebdsv5 Series Standard_E2bds_v5 Spot Virtual Machines Compute NA Consumption 0.075600 \n", + "westus2 Virtual Machines Ddsv5 Series Standard_D64ds_v5 Virtual Machines Compute NA Consumption 3.616000 \n", + "westus3 Azure Redis Cache Enterprise Flash F1500 Redis Cache Databases NA Consumption 10.430000 \n", + "\n", + " minPrice \n", + "armRegionName productName skuName serviceName serviceFamily reservationTerm type \n", + " SQL Server Web Red Hat Enterprise Linux 7 vCPU VM Virtual Machines Licenses Compute NA Consumption 0.186000 \n", + "australiaeast Virtual Machines Esv4 Series Windows E64-16s v4 Spot Virtual Machines Compute NA Consumption 2.057530 \n", + "australiasoutheast Virtual Machines Eadsv5 Series Windows E16-8ads v5 Spot Virtual Machines Compute NA Consumption 0.537088 \n", + " Virtual Machines F Series Windows F16 Spot Virtual Machines Compute NA Consumption 0.403024 \n", + "brazilsouth Virtual Machines A Series Basic A2 Virtual Machines Compute NA Consumption 0.112000 \n", + "... ... \n", + "westindia Virtual Machines Dv4 Series D2 v4 Low Priority Virtual Machines Compute NA Consumption 0.023600 \n", + "westus Premium ADLS Gen2 Hierarchical Namespace Premium ZRS Storage Storage NA Consumption 0.113000 \n", + " Virtual Machines Ebdsv5 Series Standard_E2bds_v5 Spot Virtual Machines Compute NA Consumption 0.075600 \n", + "westus2 Virtual Machines Ddsv5 Series Standard_D64ds_v5 Virtual Machines Compute NA Consumption 3.616000 \n", + "westus3 Azure Redis Cache Enterprise Flash F1500 Redis Cache Databases NA Consumption 10.430000 \n", + "\n", + "[67 rows x 2 columns]" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "result_consumption = dfi_consumption.groupby(\n", + " [\n", + " \"armRegionName\",\n", + " \"productName\",\n", + " \"skuName\",\n", + " \"serviceName\",\n", + " \"serviceFamily\",\n", + " \"reservationTerm\",\n", + " \"type\",\n", + " ]\n", + ").agg(maxPrice=(\"retailPrice\", \"max\"), minPrice=(\"retailPrice\", \"min\"))\n", + "result_consumption" + ] + }, + { + "cell_type": "markdown", + "id": "2a59fc3f", + "metadata": {}, + "source": [ + "#### Data analysis to understand service prices for type Reservation" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "addfcc59", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:19.484511Z", + "start_time": "2022-03-30T14:21:19.325994Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
currencyCodetierMinimumUnitsretailPriceunitPricearmRegionNamelocationeffectiveStartDateeffectiveEndDatemeterIdmeterName...productNameskuNameserviceNameserviceIdserviceFamilyunitOfMeasuretypeisPrimaryMeterRegionarmSkuNamereservationTerm
36USD0.018689.018689.0westus2US West 22021-11-01T00:00:00ZNA000aeefc-dae5-5264-8f64-d0838e160478D64ds v5...Virtual Machines Ddsv5 SeriesStandard_D64ds_v5Virtual MachinesDZH313Z7MMC8Compute1 HourReservationTrueStandard_D64ds_v51 Year
37USD0.036111.036111.0westus2US West 22021-11-01T00:00:00ZNA000aeefc-dae5-5264-8f64-d0838e160478D64ds v5...Virtual Machines Ddsv5 SeriesStandard_D64ds_v5Virtual MachinesDZH313Z7MMC8Compute1 HourReservationTrueStandard_D64ds_v53 Years
43USD0.039231.039231.0koreasouthKR South2021-12-01T00:00:00ZNA000c0948-0687-52ed-8efa-32a3cfa6c9edEasv4 Type2...Easv4 Series Dedicated HostEasv4 Type2Virtual MachinesDZH313Z7MMC8Compute1 HourReservationTrueEasv4_Type21 Year
45USD0.077890.077890.0koreasouthKR South2021-12-01T00:00:00ZNA000c0948-0687-52ed-8efa-32a3cfa6c9edEasv4 Type2...Easv4 Series Dedicated HostEasv4 Type2Virtual MachinesDZH313Z7MMC8Compute1 HourReservationTrueEasv4_Type23 Years
82USD0.038667.038667.0usgovarizonaUS Gov AZ2020-08-01T00:00:00ZNA0014a546-6717-582f-9680-e510e91eae91D64s v4...Virtual Machines Dsv4 SeriesD64s v4Virtual MachinesDZH313Z7MMC8Compute1 HourReservationTrueStandard_D64s_v43 Years
83USD0.020012.020012.0usgovarizonaUS Gov AZ2020-08-01T00:00:00ZNA0014a546-6717-582f-9680-e510e91eae91D64s v4...Virtual Machines Dsv4 SeriesD64s v4Virtual MachinesDZH313Z7MMC8Compute1 HourReservationTrueStandard_D64s_v41 Year
92USD0.048318.048318.0southcentralusUS South Central2020-08-01T00:00:00ZNA0016083a-928f-56fd-8eeb-39287dcf676dE64 v4...Virtual Machines Ev4 SeriesE64 v4Virtual MachinesDZH313Z7MMC8Compute1 HourReservationTrueStandard_E64_v43 Years
93USD0.025007.025007.0southcentralusUS South Central2020-08-01T00:00:00ZNA0016083a-928f-56fd-8eeb-39287dcf676dE64 v4...Virtual Machines Ev4 SeriesE64 v4Virtual MachinesDZH313Z7MMC8Compute1 HourReservationTrueStandard_E64_v41 Year
\n", + "

8 rows × 22 columns

\n", + "
" + ], + "text/plain": [ + " currencyCode tierMinimumUnits retailPrice unitPrice armRegionName \\\n", + "36 USD 0.0 18689.0 18689.0 westus2 \n", + "37 USD 0.0 36111.0 36111.0 westus2 \n", + "43 USD 0.0 39231.0 39231.0 koreasouth \n", + "45 USD 0.0 77890.0 77890.0 koreasouth \n", + "82 USD 0.0 38667.0 38667.0 usgovarizona \n", + "83 USD 0.0 20012.0 20012.0 usgovarizona \n", + "92 USD 0.0 48318.0 48318.0 southcentralus \n", + "93 USD 0.0 25007.0 25007.0 southcentralus \n", + "\n", + " location effectiveStartDate effectiveEndDate \\\n", + "36 US West 2 2021-11-01T00:00:00Z NA \n", + "37 US West 2 2021-11-01T00:00:00Z NA \n", + "43 KR South 2021-12-01T00:00:00Z NA \n", + "45 KR South 2021-12-01T00:00:00Z NA \n", + "82 US Gov AZ 2020-08-01T00:00:00Z NA \n", + "83 US Gov AZ 2020-08-01T00:00:00Z NA \n", + "92 US South Central 2020-08-01T00:00:00Z NA \n", + "93 US South Central 2020-08-01T00:00:00Z NA \n", + "\n", + " meterId meterName ... \\\n", + "36 000aeefc-dae5-5264-8f64-d0838e160478 D64ds v5 ... \n", + "37 000aeefc-dae5-5264-8f64-d0838e160478 D64ds v5 ... \n", + "43 000c0948-0687-52ed-8efa-32a3cfa6c9ed Easv4 Type2 ... \n", + "45 000c0948-0687-52ed-8efa-32a3cfa6c9ed Easv4 Type2 ... \n", + "82 0014a546-6717-582f-9680-e510e91eae91 D64s v4 ... \n", + "83 0014a546-6717-582f-9680-e510e91eae91 D64s v4 ... \n", + "92 0016083a-928f-56fd-8eeb-39287dcf676d E64 v4 ... \n", + "93 0016083a-928f-56fd-8eeb-39287dcf676d E64 v4 ... \n", + "\n", + " productName skuName serviceName \\\n", + "36 Virtual Machines Ddsv5 Series Standard_D64ds_v5 Virtual Machines \n", + "37 Virtual Machines Ddsv5 Series Standard_D64ds_v5 Virtual Machines \n", + "43 Easv4 Series Dedicated Host Easv4 Type2 Virtual Machines \n", + "45 Easv4 Series Dedicated Host Easv4 Type2 Virtual Machines \n", + "82 Virtual Machines Dsv4 Series D64s v4 Virtual Machines \n", + "83 Virtual Machines Dsv4 Series D64s v4 Virtual Machines \n", + "92 Virtual Machines Ev4 Series E64 v4 Virtual Machines \n", + "93 Virtual Machines Ev4 Series E64 v4 Virtual Machines \n", + "\n", + " serviceId serviceFamily unitOfMeasure type \\\n", + "36 DZH313Z7MMC8 Compute 1 Hour Reservation \n", + "37 DZH313Z7MMC8 Compute 1 Hour Reservation \n", + "43 DZH313Z7MMC8 Compute 1 Hour Reservation \n", + "45 DZH313Z7MMC8 Compute 1 Hour Reservation \n", + "82 DZH313Z7MMC8 Compute 1 Hour Reservation \n", + "83 DZH313Z7MMC8 Compute 1 Hour Reservation \n", + "92 DZH313Z7MMC8 Compute 1 Hour Reservation \n", + "93 DZH313Z7MMC8 Compute 1 Hour Reservation \n", + "\n", + " isPrimaryMeterRegion armSkuName reservationTerm \n", + "36 True Standard_D64ds_v5 1 Year \n", + "37 True Standard_D64ds_v5 3 Years \n", + "43 True Easv4_Type2 1 Year \n", + "45 True Easv4_Type2 3 Years \n", + "82 True Standard_D64s_v4 3 Years \n", + "83 True Standard_D64s_v4 1 Year \n", + "92 True Standard_E64_v4 3 Years \n", + "93 True Standard_E64_v4 1 Year \n", + "\n", + "[8 rows x 22 columns]" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df_reservation = df_items_2.loc[(df_items_2[\"type\"] == \"Reservation\")]\n", + "df_reservation" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "f0e7b612", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:19.602264Z", + "start_time": "2022-03-30T14:21:19.492848Z" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
armRegionNameproductNameskuNameretailPricecurrencyCodeserviceNameserviceFamilyreservationTermtype
36westus2Virtual Machines Ddsv5 SeriesStandard_D64ds_v518689.0USDVirtual MachinesCompute1 YearReservation
37westus2Virtual Machines Ddsv5 SeriesStandard_D64ds_v536111.0USDVirtual MachinesCompute3 YearsReservation
43koreasouthEasv4 Series Dedicated HostEasv4 Type239231.0USDVirtual MachinesCompute1 YearReservation
45koreasouthEasv4 Series Dedicated HostEasv4 Type277890.0USDVirtual MachinesCompute3 YearsReservation
82usgovarizonaVirtual Machines Dsv4 SeriesD64s v438667.0USDVirtual MachinesCompute3 YearsReservation
83usgovarizonaVirtual Machines Dsv4 SeriesD64s v420012.0USDVirtual MachinesCompute1 YearReservation
92southcentralusVirtual Machines Ev4 SeriesE64 v448318.0USDVirtual MachinesCompute3 YearsReservation
93southcentralusVirtual Machines Ev4 SeriesE64 v425007.0USDVirtual MachinesCompute1 YearReservation
\n", + "
" + ], + "text/plain": [ + " armRegionName productName skuName \\\n", + "36 westus2 Virtual Machines Ddsv5 Series Standard_D64ds_v5 \n", + "37 westus2 Virtual Machines Ddsv5 Series Standard_D64ds_v5 \n", + "43 koreasouth Easv4 Series Dedicated Host Easv4 Type2 \n", + "45 koreasouth Easv4 Series Dedicated Host Easv4 Type2 \n", + "82 usgovarizona Virtual Machines Dsv4 Series D64s v4 \n", + "83 usgovarizona Virtual Machines Dsv4 Series D64s v4 \n", + "92 southcentralus Virtual Machines Ev4 Series E64 v4 \n", + "93 southcentralus Virtual Machines Ev4 Series E64 v4 \n", + "\n", + " retailPrice currencyCode serviceName serviceFamily reservationTerm \\\n", + "36 18689.0 USD Virtual Machines Compute 1 Year \n", + "37 36111.0 USD Virtual Machines Compute 3 Years \n", + "43 39231.0 USD Virtual Machines Compute 1 Year \n", + "45 77890.0 USD Virtual Machines Compute 3 Years \n", + "82 38667.0 USD Virtual Machines Compute 3 Years \n", + "83 20012.0 USD Virtual Machines Compute 1 Year \n", + "92 48318.0 USD Virtual Machines Compute 3 Years \n", + "93 25007.0 USD Virtual Machines Compute 1 Year \n", + "\n", + " type \n", + "36 Reservation \n", + "37 Reservation \n", + "43 Reservation \n", + "45 Reservation \n", + "82 Reservation \n", + "83 Reservation \n", + "92 Reservation \n", + "93 Reservation " + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dfi_reservation = df_reservation[\n", + " [\n", + " \"armRegionName\",\n", + " \"productName\",\n", + " \"skuName\",\n", + " \"retailPrice\",\n", + " \"currencyCode\",\n", + " \"serviceName\",\n", + " \"serviceFamily\",\n", + " \"reservationTerm\",\n", + " \"type\",\n", + " ]\n", + "]\n", + "dfi_reservation" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "c1811bff", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-30T14:21:24.227201Z", + "start_time": "2022-03-30T14:21:23.563953Z" + }, + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
maxPriceminPrice
armRegionNameproductNameskuNameserviceNameserviceFamilyreservationTermtype
koreasouthEasv4 Series Dedicated HostEasv4 Type2Virtual MachinesCompute1 YearReservation39231.039231.0
3 YearsReservation77890.077890.0
southcentralusVirtual Machines Ev4 SeriesE64 v4Virtual MachinesCompute1 YearReservation25007.025007.0
3 YearsReservation48318.048318.0
usgovarizonaVirtual Machines Dsv4 SeriesD64s v4Virtual MachinesCompute1 YearReservation20012.020012.0
3 YearsReservation38667.038667.0
westus2Virtual Machines Ddsv5 SeriesStandard_D64ds_v5Virtual MachinesCompute1 YearReservation18689.018689.0
3 YearsReservation36111.036111.0
\n", + "
" + ], + "text/plain": [ + " maxPrice \\\n", + "armRegionName productName skuName serviceName serviceFamily reservationTerm type \n", + "koreasouth Easv4 Series Dedicated Host Easv4 Type2 Virtual Machines Compute 1 Year Reservation 39231.0 \n", + " 3 Years Reservation 77890.0 \n", + "southcentralus Virtual Machines Ev4 Series E64 v4 Virtual Machines Compute 1 Year Reservation 25007.0 \n", + " 3 Years Reservation 48318.0 \n", + "usgovarizona Virtual Machines Dsv4 Series D64s v4 Virtual Machines Compute 1 Year Reservation 20012.0 \n", + " 3 Years Reservation 38667.0 \n", + "westus2 Virtual Machines Ddsv5 Series Standard_D64ds_v5 Virtual Machines Compute 1 Year Reservation 18689.0 \n", + " 3 Years Reservation 36111.0 \n", + "\n", + " minPrice \n", + "armRegionName productName skuName serviceName serviceFamily reservationTerm type \n", + "koreasouth Easv4 Series Dedicated Host Easv4 Type2 Virtual Machines Compute 1 Year Reservation 39231.0 \n", + " 3 Years Reservation 77890.0 \n", + "southcentralus Virtual Machines Ev4 Series E64 v4 Virtual Machines Compute 1 Year Reservation 25007.0 \n", + " 3 Years Reservation 48318.0 \n", + "usgovarizona Virtual Machines Dsv4 Series D64s v4 Virtual Machines Compute 1 Year Reservation 20012.0 \n", + " 3 Years Reservation 38667.0 \n", + "westus2 Virtual Machines Ddsv5 Series Standard_D64ds_v5 Virtual Machines Compute 1 Year Reservation 18689.0 \n", + " 3 Years Reservation 36111.0 " + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "result_reservation = dfi_reservation.groupby(\n", + " [\n", + " \"armRegionName\",\n", + " \"productName\",\n", + " \"skuName\",\n", + " \"serviceName\",\n", + " \"serviceFamily\",\n", + " \"reservationTerm\",\n", + " \"type\",\n", + " ]\n", + ").agg(maxPrice=(\"retailPrice\", \"max\"), minPrice=(\"retailPrice\", \"min\"))\n", + "result_reservation" + ] + }, + { + "cell_type": "markdown", + "id": "058b5701", + "metadata": { + "ExecuteTime": { + "end_time": "2022-03-29T13:38:17.721934Z", + "start_time": "2022-03-29T13:38:17.710284Z" + } + }, + "source": [ + "#### Conclusion - \n", + "For the type Consumption In most of the cases across regions, there is slight variation between min and max price\n", + "For the type Reservation prices are fixed. Max min price analysis is not required." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.2" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": true, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}