0% found this document useful (0 votes)
202 views

Python-Module03-Case Study02

This document discusses a case study for a banking marketing campaign. The bank wants to offer loans to clients with particular professions based on data from previous successful campaigns. The tasks are to read a dataset file containing client data, build a list of unique professions, and check if a given client's profession makes them eligible for the marketing campaign. The solution provided reads the data file, extracts unique job titles, and allows inputting a profession to check eligibility and offer loans to eligible clients.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
202 views

Python-Module03-Case Study02

This document discusses a case study for a banking marketing campaign. The bank wants to offer loans to clients with particular professions based on data from previous successful campaigns. The tasks are to read a dataset file containing client data, build a list of unique professions, and check if a given client's profession makes them eligible for the marketing campaign. The solution provided reads the data file, extracts unique job titles, and allows inputting a profession to check eligibility and offer loans to eligible clients.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Module 3

Deep Dive - Functions, OOPs, Modules, Errors and Exceptions


Case Study - II

1. Business challenge/requirement
Bank of Portugal runs marketing campaign to offer loans to clients. Loan is
offered to only clients with particular professions. List of successful campaigns (with
client data) is given in attached dataset. You have to come up with program which reads
the file and builds a set of unique profession list and given input profession of client –
system tells whether client is eligible to be approached for marketing campaign.

Answer:

import pandas as pd

import numpy as np

data = open("./bank-data.csv",'rb')

df = pd.read_csv(data) # read the data

unique_jobs = [jobs.lower() for jobs in np.unique(df['job'].values)] # converting all jobs to lower

print("Set of uniques jobs : ",unique_jobs) # printing set of unique jobs

flag = 1

while(flag==1):

job_input = input("Please enter your job : ") # enter jon input till user enter END

if job_input.lower() in unique_jobs: # making input case insensitive

print("Job is in the list. Eligible for loan.")

elif job_input.upper() == 'END':

flag = 0

else : print("job not found. Not eligible for loan")


age_dict = {'max':max(df['age'].values),'min':min(df['age'].values)} # dictionary to store max and
min age

print("max age of loan : ",age_dict.get('max')) # print max age from dictionary

print("min age of loan : ",age_dict.get('min')) # print min age from dictionary

******

You might also like