Skip to content

Commit

Permalink
Fixed pep8 format
Browse files Browse the repository at this point in the history
  • Loading branch information
Nguyen committed Feb 8, 2024
1 parent e7b1dc5 commit e169144
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pvanalytics/quality/gaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,11 @@ def trim(series, days=10):
"""
start, end = start_stop_dates(series, days=days)
mask = pd.Series(False, index=series.index)

if start:
mask.loc[pd.to_datetime(start.date()).tz_localize(series.index.tz):pd.to_datetime(end.date()).tz_localize(series.index.tz)] = True
mask.loc[pd.to_datetime(start.date()).tz_localize(series.index.tz):
pd.to_datetime(end.date()).tz_localize(series.index.tz)] = \
True
return mask


Expand Down
5 changes: 3 additions & 2 deletions pvanalytics/tests/quality/test_gaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,12 @@ def test_trim_daily_index():
expected,
gaps.trim(data)
)



def test_trim_daily_index_tz_aware():
"""trim works when data has a daily index and data is tz-aware."""
data = pd.Series(True, index=pd.date_range(
start='1/1/2020', end='2/29/2020', freq='D', tz = "Etc/GMT+8"))
start='1/1/2020', end='2/29/2020', freq='D', tz="Etc/GMT+8"))
assert gaps.trim(data).all()
data.iloc[0:8] = False
data.iloc[9] = False
Expand Down

0 comments on commit e169144

Please sign in to comment.