Name: Rohan Duhaney
Your magic request: "Write a code snippet to solve Vendor Management Automation: "Create a Python-based solution for automating vendor performance evaluations and contract renewals in a data center environment." Please use fititious data for a large scale company using Python."
Email:Â smartduhaney@gmail.com
Dear Rohan Duhaney,
# Import necessary libraries
import pandas as pd
import numpy as np
import datetime as dt
# Create a dataframe with vendor information and contract details
vendor_data = pd.DataFrame({'Vendor Name': ['Vendor A', 'Vendor B', 'Vendor C', 'Vendor D'],
              'Contract Start Date': [dt.date(2021, 1, 1), dt.date(2020, 5, 1), dt.date(2019, 9, 1), dt.date(2018, 12, 1)],
              'Contract End Date': [dt.date(2023, 1, 1), dt.date(2022, 5, 1), dt.date(2021, 9, 1), dt.date(2020, 12, 1)],
              'Contract Value': [500000, 750000, 1000000, 1250000],
              'Performance Score': [4.5, 3.8, 4.2, 4.9]})
# Create a function to calculate the contract renewal date
def calculate_renewal_date(start_d
  """
  This function takes in a contract start date and calculates the renewal date
  based on a 3-year contract term.
  """
  return start_date + dt.timedelta(days=1095)
# Create a new column for renewal date using the function
vendor_data['Renewal Date'] = vendor_data['Contract Start Date'].apply(calculate_renewal
# Create a function to calculate the vendor's overall performance score
def calculate_overall_score(score)
  """
  This function takes in a performance score and calculates the overall score
  based on a weighted average of the current score and the previous year's score.
  """
  return (score + vendor_data['Performance Score'].shift(1)) / 2
# Create a new column for overall performance score using the function
vendor_data['Overall Performance Score'] = vendor_data['Performance Score'].apply(calculate_overal
# Create a function to calculate the contract renewal value
def calculate_renewal_value(value)
  """
  This function takes in a contract value and calculates the renewal value
  based on a 5% increase from the previous contract value.
  """
  return value * 1.05
# Create a new column for renewal value using the function
vendor_data['Renewal Value'] = vendor_data['Contract Value'].apply(calculate_renewa
# Filter the dataframe to only include vendors with an overall performance score of 4 or higher
high_performing_vendors = vendor_data[vendor_data['Overa
# Sort the dataframe by renewal date in ascending order
high_performing_vendors = high_performing_vendors.sort_v
# Print the final list of vendors eligible for contract renewal
print(high_performing_vendors[