File size: 902 Bytes
36aafa8
 
ffd0fc0
36aafa8
 
 
 
 
 
7308349
 
a9d5fbb
 
 
 
7308349
 
 
ffd0fc0
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import pandas as pd
import sys

cust_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data", "customer_profile.csv")
org_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data", "organization_Profile.csv")

def get_customer_details(customer_id):
    df = pd.read_csv(cust_path)
    customer_row = df[df["Customer_Id"] == customer_id]
    if customer_row.empty:
        df = pd.read_csv(org_path)
        customer_row = df[df["Customer_Id"] == customer_id]
        if customer_row.empty:
           return None, None

    customer_dict = customer_row.iloc[0].to_dict()
    return customer_row, customer_dict

if __name__ == "__main__":
    if len(sys.argv) > 1:
        input_text = sys.argv[1]
        score = get_customer_details(input_text)
        print(score)  # <-- print this so the shell can capture it
    else:
        print("No input text provided.")