Skip to content

Commit ca6d7d7

Browse files
committed
Fix pandas 3.0 FutureWarning: ChainedAssignmentError
1 parent a18f15a commit ca6d7d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

deepsensor/model/pred.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def assign(
205205
index = (lead_times[i], date)
206206
else:
207207
index = date
208-
self[var_ID][prediction_parameter].loc[index] = pred
208+
self[var_ID].loc[index, prediction_parameter] = pred
209209
elif prediction_parameter == "samples":
210210
assert len(data.shape) == 3, (
211211
f"If prediction_parameter is 'samples', and mode is 'off-grid', data must"
@@ -219,7 +219,7 @@ def assign(
219219
index = (lead_times[i], date)
220220
else:
221221
index = date
222-
self[var_ID][f"sample_{sample_i}"].loc[index] = pred
222+
self[var_ID].loc[index, f"sample_{sample_i}"] = pred
223223

224224

225225
def create_empty_spatiotemporal_xarray(

0 commit comments

Comments
 (0)