Skip to content

Commit 34de2f6

Browse files
authored
fix failing test in sec form 13f fetcher (#7171)
1 parent 3e72019 commit 34de2f6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

openbb_platform/providers/sec/openbb_sec/utils/parse_13f.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ async def parse_13f_hr(filing: str):
187187
data.loc[:, "putCall"] = data["putCall"].fillna("--")
188188

189189
# Add the period ending so that the filing is identified when multiple are requested.
190-
data["period_ending"] = to_datetime(period_ending, yearfirst=False).date()
190+
data.loc[:, "period_ending"] = to_datetime(period_ending, yearfirst=False).date()
191191
df = DataFrame(data)
192192
# Aggregate the data because there are multiple entries for each security and we need the totals.
193193
# We break it down by CUSIP, security type, and option type.
@@ -220,8 +220,8 @@ async def parse_13f_hr(filing: str):
220220
if col in df.columns and all(df[col] == 0):
221221
df.drop(columns=col, inplace=True)
222222

223-
total_value = df["value"].sum()
224-
df["weight"] = round(df["value"] / total_value, 6)
223+
total_value = df.value.sum()
224+
df.loc[:, "weight"] = round(df.value.astype(float) / total_value, 6)
225225

226226
return (
227227
df.reset_index()

0 commit comments

Comments
 (0)