Skip to content

Commit

Permalink
Fix potential for price repair to discard price=0 rows
Browse files Browse the repository at this point in the history
  • Loading branch information
ValueRaider committed Mar 1, 2024
1 parent 915bb1a commit 631a9ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions yfinance/scrapers/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ def _fix_unit_random_mixups(self, df, interval, tz_exchange, prepost):
if f_zeroes.any():
df2_zeroes = df2[f_zeroes]
df2 = df2[~f_zeroes]
df = df[~f_zeroes] # all row slicing must be applied to both df and df2
df2_orig = df[~f_zeroes] # all row slicing must be applied to both df and df2
else:
df2_zeroes = None
if df2.shape[0] <= 1:
Expand Down Expand Up @@ -954,7 +954,7 @@ def _fix_unit_random_mixups(self, df, interval, tz_exchange, prepost):
fj = f_either[:, j]
if fj.any():
c = data_cols[j]
df2.loc[fj, c] = df.loc[fj, c]
df2.loc[fj, c] = df2_orig.loc[fj, c]
if df2_zeroes is not None:
if "Repaired?" not in df2_zeroes.columns:
df2_zeroes["Repaired?"] = False
Expand Down

0 comments on commit 631a9ef

Please sign in to comment.