Skip to content

Commit

Permalink
fix: pandas v2 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
polarmutex committed Sep 17, 2023
1 parent 5d4cf82 commit 653befa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/fava_envelope/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def get_currencies(self):
return None

def generate_income_query_tables(self, month):

income_table_types = []
income_table_types.append(("Name", str(str)))
income_table_types.append(("Amount", str(Decimal)))
Expand Down Expand Up @@ -85,7 +84,6 @@ def generate_income_query_tables(self, month):
return income_table_types, income_table_rows

def generate_envelope_query_tables(self, month):

envelope_table_types = []
envelope_table_types.append(("Account", str(str)))
envelope_table_types.append(("Budgeted", str(Decimal)))
Expand Down
15 changes: 6 additions & 9 deletions src/fava_envelope/modules/beancount_envelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

class BeancountEnvelope:
def __init__(self, entries, options_map, currency):

self.entries = entries
self.options_map = options_map
self.currency = currency
Expand Down Expand Up @@ -115,7 +114,6 @@ def _find_envelop_settings(self):
)

def envelope_tables(self):

months = []
date_current = self.date_start
while date_current < self.date_end:
Expand Down Expand Up @@ -163,19 +161,21 @@ def envelope_tables(self):
for index, row in self.envelope_df.iterrows():
for index2, month in enumerate(months):
if index2 == 0:
row[month, "available"] = (
self.envelope_df[month, "available"][index] = (
row[month, "budgeted"] + row[month, "activity"]
)
else:
prev_available = row[months[index2 - 1], "available"]
prev_available = self.envelope_df[
months[index2 - 1], "available"
][index]
if prev_available > 0 or self.negative_rollover:
row[month, "available"] = (
self.envelope_df[month, "available"][index] = (
prev_available
+ row[month, "budgeted"]
+ row[month, "activity"]
)
else:
row[month, "available"] = (
self.envelope_df[month, "available"][index] = (
row[month, "budgeted"] + row[month, "activity"]
)

Expand Down Expand Up @@ -239,15 +239,13 @@ def envelope_tables(self):
return self.income_df, self.envelope_df, self.currency

def _calculate_budget_activity(self):

# Accumulate expenses for the period
balances = collections.defaultdict(
lambda: collections.defaultdict(inventory.Inventory)
)
all_months = set()

for entry in data.filter_txns(self.entries):

# Check entry in date range
if entry.date < self.date_start or entry.date > self.date_end:
continue
Expand All @@ -270,7 +268,6 @@ def _calculate_budget_activity(self):
continue

for posting in entry.postings:

account = posting.account
for regexp, target_account in self.mappings:
if regexp.match(account):
Expand Down

0 comments on commit 653befa

Please sign in to comment.