Skip to content

Commit eb478d4

Browse files
authored
Numpy extract value from array with single index warning fixed
1 parent bcec78b commit eb478d4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

stationary_bootstrap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ def stationary_bootstrap(data: np.ndarray, m: float, sample_length: int)-> np.nd
5252
accept = 1/m
5353
data_length = data.shape[0]
5454

55-
sample_index = np.random.randint(0,high =data_length,size=1)
55+
sample_index = np.random.randint(0, high = data_length, size=1)[0]
5656
sample = np.zeros((sample_length,))
5757
for i_sample in range(sample_length):
5858
if np.random.uniform(0,1,1)>=accept:
5959
sample_index += 1
6060
if sample_index >= data_length:
6161
sample_index=0
6262
else:
63-
sample_index = np.random.randint(0,high = data_length,size=1)
63+
sample_index = np.random.randint(0,high = data_length,size=1)[0]
6464

6565
sample[i_sample] = data[sample_index]
66-
return sample
66+
return sample

0 commit comments

Comments
 (0)