示例#1
0
 def __init__(self, fname, category=None, start_date=None, end_date=None):
     self.parser = CapitalOneParser(fname,
                                    start_date=start_date,
                                    end_date=end_date)
     self.merchant_parser = MerchantParser(self.parser.get_dataframe(),
                                           category=category)
     self.categories = self.parser.get_categories()
     self.cardholders = self.parser.get_cardholders()
     self.min_date = self.parser.get_min_date().to_pydatetime()
     self.max_date = self.parser.get_max_date().to_pydatetime()
     self.num_months = max(
         TransactionDateUtil.get_num_months_between_dates(
             self.min_date, self.max_date), 1)
     self.num_weeks = max(
         TransactionDateUtil.get_num_weeks_between_dates(
             self.min_date, self.max_date), 1)
     self.num_days = max(
         TransactionDateUtil.get_num_days_between_dates(
             self.min_date, self.max_date), 1)
     self.spending_per_category = None
     self.spending_per_category_per_cardholder = None
     self.percent_per_category_per_cardholder = None
     self.percentage_per_category = None
     self.total_spent = None
     self.total_spent_per_cardholder = None
示例#2
0
文件: mojito.py 项目: sierraa/mojito
def cli(ctx, filename, start, finish, verbose, debug):
    ctx.ensure_object(dict)
    if debug:
        logging.basicConfig(level=logging.DEBUG)
    if start or finish:
        TransactionDateUtil.validate_dates(start, finish)
    ctx.obj['START'] = start
    ctx.obj['FINISH'] = finish
    ctx.obj['FILENAME'] = filename
    ctx.obj['VERBOSE'] = verbose
示例#3
0
 def test_number_of_months_between_dates(self):
     start_date = "2020-01-01"
     end_date = "2020-12-31"
     num_months = TransactionDateUtil.get_num_months_between_dates(start_date, end_date)
     self.assertEqual(num_months, 11)
示例#4
0
 def test_number_of_days_between_dates_zero(self):
     start_date = "2020-01-01"
     end_date = "2020-01-01"
     num_days = TransactionDateUtil.get_num_days_between_dates(start_date, end_date)
     self.assertEqual(num_days, 0)