aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/report_ops/wires.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/python/report_ops/wires.py b/python/report_ops/wires.py
index fb0a6120..7fe70940 100644
--- a/python/report_ops/wires.py
+++ b/python/report_ops/wires.py
@@ -80,11 +80,9 @@ class BNYWireReport(WireReport, custodian="BNY", dtkey="%Y%m%d%H%M%S"):
df["Local Amount"] = pd.to_numeric(
df["Local Amount"].str.replace(",", "")
) # Not sure how to avoid this with the thousands
- df["Wire Details"] = df.apply(
- lambda x: x["Transaction Description 1"]
- if x["Transaction Type Code"] == "CW"
- else x["Transaction Description 2"],
- axis=1,
+ df["Wire Details"] = df["Transaction Description 1"]
+ df["Wire Details"] = df.where(
+ df["Transaction Type Code"] == "CW", df["Transaction Description 2"]
)
return (
(self.date, self.fund, self.custodian, *t)
@@ -110,8 +108,9 @@ class BNYWireReport(WireReport, custodian="BNY", dtkey="%Y%m%d%H%M%S"):
class NTWireReport(WireReport, custodian="NT"):
def __iter__(self):
df = pd.read_csv(self.get_report())
- _ccy_mapping = {"EURO - EUR": "EUR", "U.S. DOLLARS - USD": "USD"}
- df["Currency"] = df["N-GL-AC30"].apply(lambda x: _ccy_mapping[x])
+ df["Currency"] = df["N-GL-AC30"].map(
+ {"EURO - EUR": "EUR", "U.S. DOLLARS - USD": "USD"}
+ )
return (
(self.date, self.fund, self.custodian, *t)
for t in df[
@@ -145,9 +144,8 @@ class UMBWireReport(WireReport, custodian="UMB"):
def __iter__(self):
df = pd.read_excel(self.get_report(), skiprows=3)
- df["index"] = df.index
- df["Unique Ref"] = df.apply(
- lambda x: f'{x["Transaction Date"]}-{x["index"]}', axis=1
+ df["Unique Ref"] = (
+ df["Transaction Date"].astype("str") + "-" + df.index.astype("str")
)
if not df.iloc[0]["Transaction Date"].startswith("No records"):
return (
@@ -178,9 +176,8 @@ class UMBWireReport(WireReport, custodian="UMB"):
class SCOTIAWireReport(WireReport, custodian="SCOTIA"):
def __iter__(self):
df = pd.read_excel(self.get_report(), skipfooter=2)
- df["Amount"] = df.apply(
- lambda x: x["Cr Amount"] if x["Dr/Cr"] == "Cr" else -x["Dr Amount"], axis=1
- )
+ df["Amount"] = df["Cr Amount"]
+ df["Amount"] = df["Amount"].where(df["Dr/Cr"] == "Cr", -df["Amount"])
return (
(self.date, self.fund, self.custodian, *t)
for t in df[