Removed misc print statements

This commit is contained in:
Cal.W 2020-06-28 21:48:12 +10:00
parent ee0367b495
commit ccd1b813a4

View File

@ -127,17 +127,10 @@ def calculateStats(transactions, yearRangeVal=None, monthRangeVal=None, otherFel
if isinstance(monthRangeVal, list) or isinstance(monthRangeVal, tuple): monthRange = lambda x: x[1].month in monthRangeVal
if isinstance(monthRangeVal, int) or isinstance(monthRangeVal, float): monthRange = lambda x: x[1].month == int(monthRangeVal)
if not isinstance(yearRangeVal, type(monthRangeVal)): otherFelid = lambda x: True
if not isinstance(yearRangeVal, type(monthRange)): otherFelid = lambda x: True
periodTransactions = [x for x in transactions if yearRange(x) and monthRange(x) and otherFelid(x)]
print(periodTransactions)
print("*"*70)
periodTransactions = sorted(periodTransactions, reverse = True, key = lambda x: x[1])
print(periodTransactions)
input("$"*70)
stats = {
"credits" : round(sum([abs(x[2]) for x in periodTransactions if x[2] > 0]), 2) if len([abs(x[2]) for x in periodTransactions if x[2] > 0]) > 0 else float(0),
@ -154,6 +147,7 @@ def calculateStats(transactions, yearRangeVal=None, monthRangeVal=None, otherFel
return stats
def foo(transactions):
years = []
for trans in transactions:
@ -166,8 +160,8 @@ def foo(transactions):
if __name__ == "__main__":
trans = loadTransactionData()
y = lambda x: x[-2] == TRANSACTION_TYPES[0]
print(calculateStats(trans, otherFelid=y))
stats = calculateStats(trans)
print(stats['averageBalance'])
#calculateStats(trans)