fix failing test in sec form 13f fetcher (#7171)

This commit is contained in:
Danglewood
2025-07-16 23:15:27 -07:00
committed by GitHub
parent 3e72019476
commit 34de2f6142

View File

@@ -187,7 +187,7 @@ async def parse_13f_hr(filing: str):
data.loc[:, "putCall"] = data["putCall"].fillna("--")
# Add the period ending so that the filing is identified when multiple are requested.
data["period_ending"] = to_datetime(period_ending, yearfirst=False).date()
data.loc[:, "period_ending"] = to_datetime(period_ending, yearfirst=False).date()
df = DataFrame(data)
# Aggregate the data because there are multiple entries for each security and we need the totals.
# We break it down by CUSIP, security type, and option type.
@@ -220,8 +220,8 @@ async def parse_13f_hr(filing: str):
if col in df.columns and all(df[col] == 0):
df.drop(columns=col, inplace=True)
total_value = df["value"].sum()
df["weight"] = round(df["value"] / total_value, 6)
total_value = df.value.sum()
df.loc[:, "weight"] = round(df.value.astype(float) / total_value, 6)
return (
df.reset_index()