I'm trying to flag some price data as "stale" if the quoted price of the security hasn't changed over lets say 3 trading days. I'm currently trying it with:
firm["dev"] = np.std(firm["Price"],firm["Price"].shift(1),firm["Price"].shift(2))
firm["flag"] == np.where(firm["dev"] = 0, 1, 0)
But I'm getting nowhere with it. This is what my dataframe would look like.
| Index | Price | Flag |
|---|---|---|
| 1 | 10 | 0 |
| 2 | 11 | 0 |
| 3 | 12 | 0 |
| 4 | 12 | 0 |
| 5 | 12 | 1 |
| 6 | 11 | 0 |
| 7 | 13 | 0 |
Any help is appreciated!