aboutsummaryrefslogtreecommitdiffstats
path: root/python/report_ops
diff options
context:
space:
mode:
Diffstat (limited to 'python/report_ops')
-rw-r--r--python/report_ops/cash.py28
1 files changed, 11 insertions, 17 deletions
diff --git a/python/report_ops/cash.py b/python/report_ops/cash.py
index 1df97d63..4dc69354 100644
--- a/python/report_ops/cash.py
+++ b/python/report_ops/cash.py
@@ -76,11 +76,9 @@ class NTCashReport(CashReport, custodian="NT"):
class UMBCashReport(CashReport, custodian="UMB"):
def __iter__(self):
df = pd.read_excel(self.get_report(), skiprows=3)
- df = (
- df.groupby(["Portfolio #", "Currency", "Portfolio Name"])
- .sum(numeric_only=True)
- .reset_index()
- )
+ df = df.groupby(
+ ["Portfolio #", "Currency", "Portfolio Name"], as_index=False
+ ).sum(numeric_only=True)
return (
(prev_business_day(self.date), self.fund, *t)
for t in df[
@@ -91,18 +89,14 @@ class UMBCashReport(CashReport, custodian="UMB"):
class BNYCashReport(CashReport, custodian="BNY"):
def __iter__(self):
- df = pd.read_csv(self.get_report())
- df["Beginning Balance Local"] = df["Beginning Balance Local"].apply(
- lambda s: "-" + s[1:-1] if s.startswith("(") else s
- )
- df["Beginning Balance Local"] = pd.to_numeric(
- df["Beginning Balance Local"].str.replace(",", "")
- )
- df = (
- df.groupby(["Account Number", "Account Name", "Local Currency Code"])
- .sum(numeric_only=True)
- .reset_index()
- )
+ df = pd.read_csv(self.get_report(), thousands=",")
+ if df["Beginning Balance Local"].dtype == "object":
+ df["Beginning Balance Local"].apply(
+ lambda s: -float(s[1:-1]) if s.startswith("(") else float(s)
+ )
+ df = df.groupby(
+ ["Account Number", "Account Name", "Local Currency Code"], as_index=False
+ ).sum(numeric_only=True)
return (
(prev_business_day(self.date), self.fund, *t)
for t in df[