Sulaiman8 commited on
Commit
308b000
·
verified ·
1 Parent(s): 6ec6e89

Update data.py

Browse files
Files changed (1) hide show
  1. data.py +46 -39
data.py CHANGED
@@ -1,39 +1,46 @@
1
- import json
2
- import pandas as pd
3
-
4
- #for adding bank name to the cards in the graph
5
- eligibility_df = pd.read_csv("cards_eligibility_updated.csv")
6
- card_to_bank = dict(zip(eligibility_df['Name'], eligibility_df['Bank']))
7
-
8
- # Loading credit card data
9
- df = pd.read_csv("credit_card_data_updated.csv")
10
- card_descriptions = dict(zip(df["name"], df["description"]))
11
-
12
- # Loading all 55 cards for comparison feature
13
- df_all_cards = pd.read_csv("credit_card_data_updated.csv")
14
- all_card_names = df_all_cards["name"].tolist()
15
- all_card_lookup = dict(zip(df_all_cards["name"], df_all_cards["description"]))
16
-
17
- with open('for_graph_construction_(expanded labels).json') as f:
18
- card_feature_data = json.load(f)
19
-
20
- card_features_lookup = {
21
- card['card_name']: set(card['features'])
22
- for card in card_feature_data
23
- }
24
-
25
-
26
- #function for the chatbot functionality
27
- eligibility_lookup = {}
28
- for _, row in eligibility_df.iterrows():
29
- card_name = row["Name"].strip()
30
- eligibility_info = f"""
31
- - Bank: {row['Bank']}
32
- - Age: {row['Minimum Age']} to {row['Maximum Age']}
33
- - Minimum Income: {row['Minimum Income (LPA)']} LPA
34
- - Minimum Credit Score: {row['Minimum Credit Score']}
35
- - Joining Fee: ₹{row['Joining fee']}
36
- - Annual Fee: ₹{row['Annual fee']}
37
- """
38
- eligibility_lookup[card_name] = eligibility_info.strip()
39
-
 
 
 
 
 
 
 
 
1
+ import json
2
+ import pandas as pd
3
+
4
+ #for adding bank name to the cards in the graph
5
+ eligibility_df = pd.read_csv("cards_eligibility_updated.csv")
6
+ card_to_bank = dict(zip(eligibility_df['Name'], eligibility_df['Bank']))
7
+
8
+ # Loading credit card data
9
+ df = pd.read_csv("credit_card_data_updated.csv")
10
+ card_descriptions = dict(zip(df["name"], df["description"]))
11
+
12
+ # Loading all 55 cards for comparison feature
13
+ df_all_cards = pd.read_csv("credit_card_data_updated.csv")
14
+ all_card_names = df_all_cards["name"].tolist()
15
+ all_card_lookup = dict(zip(df_all_cards["name"], df_all_cards["description"]))
16
+
17
+ with open('for_graph_construction_(expanded labels).json') as f:
18
+ card_feature_data = json.load(f)
19
+
20
+ card_features_lookup = {
21
+ card['card_name']: set(card['features'])
22
+ for card in card_feature_data
23
+ }
24
+
25
+
26
+ #function for the chatbot functionality
27
+ eligibility_lookup = {}
28
+ for _, row in eligibility_df.iterrows():
29
+ card_name = row["Name"].strip()
30
+ eligibility_info = f"""
31
+ - Bank: {row['Bank']}
32
+ - Age: {row['Minimum Age']} to {row['Maximum Age']}
33
+ - Minimum Income: {row['Minimum Income (LPA)']} LPA
34
+ - Minimum Credit Score: {row['Minimum Credit Score']}
35
+ - Joining Fee: ₹{row['Joining fee']}
36
+ - Annual Fee: ₹{row['Annual fee']}
37
+ """
38
+ eligibility_lookup[card_name] = eligibility_info.strip()
39
+
40
+ def get_all_features():
41
+ with driver.session() as session:
42
+ result = session.run("MATCH (f:Feature) RETURN f.name AS feature")
43
+ return [record["feature"] for record in result]
44
+
45
+ features = get_all_features()
46
+