-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcategories.py
162 lines (160 loc) · 3.33 KB
/
categories.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
categories = {
'Auto & Transport': [
'Auto Insurance',
'Auto Payment',
'Gas & Fuel',
'Parking',
'Public Transportation',
'Ride Share',
'Service & Parts'
],
'Bills & Utilities': [
'Home Phone',
'Internet',
'Mobile Phone',
'Television',
'Utilities',
],
'Business Services': [
'Advertising',
'Legal',
'Office Supplies',
'Printing',
'Shipping',
],
'Education': [
'Books & Supplies',
'Student Loan',
'Tuition',
],
'Entertainment': [
'Amusement',
'Arts',
'Movies & DVDs',
'Music',
'Newspapers & Magazines',
],
'Fees & Charges': [
'ATM Fee',
'Bank Fee',
'Finance Charge',
'Late Fee',
'Service Fee',
'Trade Commissions',
],
'Financial': [
'Financial Advisor',
'Life Insurance',
],
'Food & Dining': [
'Alcohol & Bars',
'Coffee Shops',
'Fast Food',
'Food Delivery',
'Groceries',
'Restaurants',
],
'Gifts & Donations': [
'Charity',
'Gift',
],
'Health & Fitness': [
'Dentist',
'Doctor',
'Eyecare',
'Gym',
'Health Insurance',
'Pharmacy',
'Sports',
],
'Home': [
'Furnishings',
'Home Improvement',
'Home Insurance',
'Home Services',
'Home Supplies',
'Lawn & Garden',
'Mortgage & Rent',
],
'Income': [
'Bonus',
'Interest Income',
'Paycheck',
'Reimbursement',
'Rental Income',
'Returned Purchase',
],
'Investments': [
'Buy',
'Deposit',
'Dividend & Cap Gains',
'Sell',
'Withdrawal',
],
'Kids': [
'Allowance',
'Baby Supplies',
'Babysitter & Daycare',
'Child Support',
'Kids Activities',
'Toys',
],
'Loans': [
'Loan Fees and Charges',
'Loan Insurance',
'Loan Interest',
'Loan Payment',
'Loan Principal',
],
'Misc Expenses': [],
'Personal Care': [
'Hair',
'Laundry',
'Spa & Massage',
],
'Pets': [
'Pet Food & Supplies',
'Pet Grooming',
'Veterinary',
],
'Shopping': [
'Books',
'Clothing',
'Electronics & Software',
'Hobbies',
'Sporting Goods',
],
'Taxes': [
'Federal Tax',
'Local Tax',
'Property Tax',
'Sales Tax',
'State Tax',
],
'Transfer': [
'Credit Card Payment',
'Transfer for Cash Spending',
],
'Travel': [
'Air Travel',
'Hotel',
'Rental Car & Taxi',
'Vacation',
],
'Uncategorized': [
'Cash & ATM',
'Check',
],
}
def category_reverse_lookup(sub_category: str) -> str:
if sub_category in categories:
return str
for k in categories:
if sub_category in categories[k]:
return k
return 'Uncategorized'
def get_categories(input_category: str) -> str:
if input_category in categories:
return input_category, None
else:
return category_reverse_lookup(input_category), input_category