Skip to content

Commit

Permalink
update on both .shift() and [index].iloc[column] deprecation warning (#…
Browse files Browse the repository at this point in the history
…510)

* update on both .shift() and [index].iloc[column] deprecation warning of pandas

Signed-off-by: Jonita Ruiter <[email protected]>

* Format Python code with Black

Signed-off-by: black <[email protected]>

* trying to fix black format fail

Signed-off-by: Jonita Ruiter <[email protected]>

* Format Python code with Black

Signed-off-by: black <[email protected]>

* trying to fix black format fail2

Signed-off-by: Jonita Ruiter <[email protected]>

---------

Signed-off-by: Jonita Ruiter <[email protected]>
Signed-off-by: black <[email protected]>
Co-authored-by: black <[email protected]>
  • Loading branch information
JonitaRuiter and actions-user authored Feb 20, 2024
1 parent 5616be9 commit 0ccf134
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion openstef/feature_engineering/lag_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def generate_lag_feature_functions(
for minutes in lag_times_minutes: # Add intraday-lag functions (lags in minutes)

def func(x, shift=minutes):
return x.shift(freq="T", periods=1 * shift)
return x.shift(freq="min", periods=1 * shift)

new = {"T-" + str(int(minutes)) + "min": func}
lag_functions.update(new)
Expand Down
5 changes: 3 additions & 2 deletions openstef/model/standard_deviation_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ def _calculate_standard_deviation(
# For the time starts with 00, 01, 02, etc. TODO (MAKE MORE ELEGANT SOLUTION THAN A LOOP)
for hour in range(24):
hour_error = error[error.index == hour]
result["stdev"].iloc[hour] = np.std(hour_error)
result["hour"].iloc[hour] = hour

result.loc[hour, "stdev"] = np.std(hour_error)
result.loc[hour, "hour"] = hour

result = result.astype("float")

Expand Down
2 changes: 1 addition & 1 deletion test/unit/pipeline/test_create_basecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def setUp(self) -> None:
- (forecast_input.index.max() - timedelta(days=7))
).total_seconds()
forecast_input = forecast_input.shift(
freq="T", periods=int(int(offset_seconds / 60.0 / 15.0) * 15)
freq="min", periods=int(int(offset_seconds / 60.0 / 15.0) * 15)
)

self.forecast_input = forecast_input
Expand Down

0 comments on commit 0ccf134

Please sign in to comment.