Module costs

Functions

def account_services_costs(month: int, year: int, account_id)

Returns a DataFrame with the costs for each service of a specific account, from the past and current month

Parameters

month (int): The month to be used as reference year (int): The year to be used as reference account_id (str): The ID of the account

Returns

df (DataFrame): A DataFrame with the following columns: - "Service": The name of the service - "Past Month": The total cost of the service in the past month - "Current Month": The total cost of the service in the current month - "Absolute Diff": The absolute difference between the costs of the past and current month - "Relative Diff (%)": The relative difference between the costs of the past and current month - "Details": An empty column to be filled

def all_account_costs(month: int, year: int)

Returns a DataFrame with the costs for each account, from the past and current month

Parameters

month (int): The month to be used as reference year (int): The year to be used as reference

Returns

df (DataFrame): A DataFrame with the following columns: - "Account ID": The ID of the account - "Account Name": The name of the account - "Past Month": The total cost of the account in the past month - "Current Month": The total cost of the account in the current month - "Absolute Diff": The absolute difference between the costs of the past and current month - "Relative Diff (%)": The relative difference between the costs of the past and current month - "Details": An empty column to be filled

def clean_excel(file_name: str)

Adjusts the column widths of an Excel file

Parameters

file_name (str): The name of the Excel file to be adjusted

def get_dates(month: int, year: int)

Returns the start and end date of the previous month and the next month

Parameters

month (int): The month to be used as reference year (int): The year to be used as reference

Returns

start_date (str): The start date of the previous month in the format 'YYYY-MM-DD' end_date (str): The end date of the next month in the format 'YYYY-MM-DD'

def service_usage_type_costs(month: int, year: int, account_id, service)

Returns a DataFrame with the costs for each usage type of a specific service of a specific account, from the past and current month

Parameters

month (int): The month to be used as reference year (int): The year to be used as reference account_id (str): The ID of the account service (str): The name of the service

Returns

df (DataFrame): A DataFrame with the following columns: - "Usage Type": The name of the usage type - "Past Month": The total cost of the usage type in the past month - "Current Month": The total cost of the usage type in the current month - "Absolute Diff": The absolute difference between the costs of the past and current month - "Relative Diff (%)": The relative difference between the costs of the past and current month - "Details": An empty column to be filled