Giter Site home page Giter Site logo

myon-bioinformatics / oci-cost-analysis Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 13 KB

This script processes "cost data" from Oracle Cloud Infrastructure (OCI).The data is sourced from OCI's Cost Management, specifically from the "Cost Analysis" -> "Cost Details" section.

Home Page: https://www.oracle.com/cloud/cost-management-and-governance/

License: MIT License

Python 100.00%
cost-analysis cost-management oci oracle-cloud-infrastructure python python3 cost-details

oci-cost-analysis's Introduction

Overview

This script processes "cost data" from Oracle Cloud Infrastructure (OCI).

The data is sourced from OCI's Cost Management, specifically from the "Cost Analysis" -> "Cost Details" section.

Steps

  1. Download Data:

    • Log in to Oracle Cloud Infrastructure.
    • Navigate to Cost Management -> Cost Analysis -> Cost Details.
    • Click on "Download table as CSV" to obtain the cost data.
  2. Data Processing:

    • The downloaded CSV data is processed to extract relevant columns: Date (UTC), Block Storage, Compute, Database, Load Balancer, MySQL, Object Storage, Telemetry, Virtual Cloud Network, and Total (all in USD).
    • If the amounts in JPY are converted to USD using an exchange rate (example: 1 USD = 150 JPY).
  3. Script Execution:

    • The script iterates over the processed data and prints each date along with the total cost in USD.
    • The output format is: Date (UTC): <date>, Total (USD): <total>.

Example

import pandas as pd

def print_date_total_oci_from_csv(file_path):
    # Load the CSV file into a DataFrame
    dataframe = pd.read_csv(file_path)
    
    # Iterate over each row and print Date (UTC) and Total (USD)
    for index, row in dataframe.iterrows():
        print(f"Date (UTC): {row['Date (UTC)']}, Total (USD): {row['Total (USD)']}")

# Example usage
if __name__ == "__main__":  
  csv_file_path = "oci-cost-details.csv"
  print_date_total_oci_from_csv(csv_file_path)

Output

Date (UTC): May 16 2024, Total (USD): 1.3608014053333333
Date (UTC): May 17 2024, Total (USD): 1.699895054
Date (UTC): May 18 2024, Total (USD): 1.699895054
Date (UTC): May 19 2024, Total (USD): 1.699895054
Date (UTC): May 20 2024, Total (USD): 0.20968403153333334
Date (UTC): May 21 2024, Total (USD): 0.060215053760000005
Date (UTC): May 22 2024, Total (USD): 0.060215053760000005
Date (UTC): May 23 2024, Total (USD): 0.055197126613333335
Date (UTC): May 24 2024, Total (USD): 6.785582786666667

oci-cost-analysis's People

Contributors

myon-bioinformatics avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.