My dataframe look like this:

[![enter image description here](https://i.stack.imgur.com/12JTW.png)](https://i.stack.imgur.com/12JTW.png)

I want to set the `speed` into a uniform random value between 0,1, if the `dir` is 999 and if 'speed' is 0.

I do this: 

```
df.loc[(df['dir'] == 999)&(df['speed'] == 0), 'speed'] = np.random.uniform(0,1)

```

But it turns out every speed is set into same value:

```
date
19800111    0.453046
19800111    0.453046
19800111    0.453046
19800111    0.453046
19800111    0.453046
19800111    0.453046
19800111    0.453046
19800111    0.453046

```

I'm not sure what I did is wrong? How can I fix this?