Smartcollegeai: Vendor Management Automation

Customer Information & Request
Name: Rohan Duhaney
Your magic request: "Write a code snippet to solve Vendor Management Automation: "Create a BMC Control-M solution to schedule and track vendor performance assessments and contract renewals." using Python." please use fititious data for a large scale company

Dear Rohan Duhaney,

# Import necessary libraries
import pandas as pd
import numpy as np

# Create a dataframe to store vendor information
vendor_df = pd.DataFrame(columns=['Vendor Name', 'Contract Start Date', 'Contract End Date', 'Performance Assessment Date', 'Renewal Status'])

# Add sample data for demonstration
vendor_df.loc[0] = ['Vendor A', '2020-01-01', '2022-01-01', '2021-01-01', 'Pending']
vendor_df.loc[1] = ['Vendor B', '2019-06-01', '2021-06-01', '2020-06-01', 'Renewed']
vendor_df.loc[2] = ['Vendor C', '2018-12-01', '2021-12-01', '2020-12-01', 'Expired']
vendor_df.loc[3] = ['Vendor D', '2020-03-01', '2023-03-01', '2022-03-01', 'Pending']
vendor_df.loc[4] = ['Vendor E', '2019-09-01', '2022-09-01', '2021-09-01', 'Renewed']

# View the dataframe

# Create a function to calculate the remaining contract duration
def calculate_remaining_duration(start_date, end_date):
    # Convert dates to datetime objects
    start_date = pd.to_datetime(start_date)
    end_date = pd.to_datetime(end_date)

    # Calculate the difference in years between the two dates
    duration = (end_date - start_date) / np.timedelta64(1, 'Y')

    # Round up the duration to the nearest integer
    duration = int(np.ceil(duration))

    return duration

# Add a column for remaining contract duration
vendor_df['Remaining Contract Duration'] = vendor_df.apply(lambda x: calculate_remaining_duration(x['Contract Start Date'], x['Contract End Date']), axis=1)

# View the updated dataframe

# Create a function to calculate the days until performance assessment
def calculate_days_until_assessment(assessment_date):
    # Convert assessment date to datetime object
    assessment_date = pd.to_datetime(assessment_date)

    # Calculate the difference in days between the assessment date and today's date
    days_until_assessment = (assessment_date -

    return days_until_assessment

# Add a column for days until performance assessment
vendor_df['Days Until Performance Assessment'] = vendor_df['Performance Assessment Date'].apply(calculate_days_until_assessment)

# View the updated dataframe

# Create a function to determine if a vendor needs to be renewed
def determine_renewal_status(remaining_duration, days_until_assessment):
    # If the remaining contract duration is less than or equal to 1 year and the days until assessment is less than or equal to 90 days, the vendor needs to be renewed
    if remaining_duration <= 1 and days_until_assessment <= 90:
        return 'Renewal Required'
        return 'No Renewal Required'

# Add a column for renewal status
vendor_df['Renewal Status'] = vendor_df.apply(lambda x: determine_renewal_status(x['Remaining Contract Duration'], x['Days Until Performance Assessment']), axis=1)

# View the updated dataframe

# Export the dataframe to a CSV file for record-keeping
vendor_df.to_csv('Vendor Management Automation.csv', index=False)
Back to blog