---
source: crates/ruff_linter/src/rules/numpy/mod.rs
---
NPY003.py:4:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead
  |
2 |     import numpy as np
3 |
4 |     np.round_(np.random.rand(5, 5), 2)
  |     ^^^^^^^^^ NPY003
5 |     np.product(np.random.rand(5, 5))
6 |     np.cumproduct(np.random.rand(5, 5))
  |
  = help: Replace with `np.round`

ℹ Safe fix
1 1 | def func():
2 2 |     import numpy as np
3 3 | 
4   |-    np.round_(np.random.rand(5, 5), 2)
  4 |+    np.round(np.random.rand(5, 5), 2)
5 5 |     np.product(np.random.rand(5, 5))
6 6 |     np.cumproduct(np.random.rand(5, 5))
7 7 |     np.sometrue(np.random.rand(5, 5))

NPY003.py:5:5: NPY003 [*] `np.product` is deprecated; use `np.prod` instead
  |
4 |     np.round_(np.random.rand(5, 5), 2)
5 |     np.product(np.random.rand(5, 5))
  |     ^^^^^^^^^^ NPY003
6 |     np.cumproduct(np.random.rand(5, 5))
7 |     np.sometrue(np.random.rand(5, 5))
  |
  = help: Replace with `np.prod`

ℹ Safe fix
2 2 |     import numpy as np
3 3 | 
4 4 |     np.round_(np.random.rand(5, 5), 2)
5   |-    np.product(np.random.rand(5, 5))
  5 |+    np.prod(np.random.rand(5, 5))
6 6 |     np.cumproduct(np.random.rand(5, 5))
7 7 |     np.sometrue(np.random.rand(5, 5))
8 8 |     np.alltrue(np.random.rand(5, 5))

NPY003.py:6:5: NPY003 [*] `np.cumproduct` is deprecated; use `np.cumprod` instead
  |
4 |     np.round_(np.random.rand(5, 5), 2)
5 |     np.product(np.random.rand(5, 5))
6 |     np.cumproduct(np.random.rand(5, 5))
  |     ^^^^^^^^^^^^^ NPY003
7 |     np.sometrue(np.random.rand(5, 5))
8 |     np.alltrue(np.random.rand(5, 5))
  |
  = help: Replace with `np.cumprod`

ℹ Safe fix
3 3 | 
4 4 |     np.round_(np.random.rand(5, 5), 2)
5 5 |     np.product(np.random.rand(5, 5))
6   |-    np.cumproduct(np.random.rand(5, 5))
  6 |+    np.cumprod(np.random.rand(5, 5))
7 7 |     np.sometrue(np.random.rand(5, 5))
8 8 |     np.alltrue(np.random.rand(5, 5))
9 9 | 

NPY003.py:7:5: NPY003 [*] `np.sometrue` is deprecated; use `np.any` instead
  |
5 |     np.product(np.random.rand(5, 5))
6 |     np.cumproduct(np.random.rand(5, 5))
7 |     np.sometrue(np.random.rand(5, 5))
  |     ^^^^^^^^^^^ NPY003
8 |     np.alltrue(np.random.rand(5, 5))
  |
  = help: Replace with `np.any`

ℹ Safe fix
4 4 |     np.round_(np.random.rand(5, 5), 2)
5 5 |     np.product(np.random.rand(5, 5))
6 6 |     np.cumproduct(np.random.rand(5, 5))
7   |-    np.sometrue(np.random.rand(5, 5))
  7 |+    np.any(np.random.rand(5, 5))
8 8 |     np.alltrue(np.random.rand(5, 5))
9 9 | 
10 10 | 

NPY003.py:8:5: NPY003 [*] `np.alltrue` is deprecated; use `np.all` instead
  |
6 |     np.cumproduct(np.random.rand(5, 5))
7 |     np.sometrue(np.random.rand(5, 5))
8 |     np.alltrue(np.random.rand(5, 5))
  |     ^^^^^^^^^^ NPY003
  |
  = help: Replace with `np.all`

ℹ Safe fix
5 5 |     np.product(np.random.rand(5, 5))
6 6 |     np.cumproduct(np.random.rand(5, 5))
7 7 |     np.sometrue(np.random.rand(5, 5))
8   |-    np.alltrue(np.random.rand(5, 5))
  8 |+    np.all(np.random.rand(5, 5))
9 9 | 
10 10 | 
11 11 | def func():

NPY003.py:14:5: NPY003 [*] `np.round_` is deprecated; use `np.round` instead
   |
12 |     from numpy import round_, product, cumproduct, sometrue, alltrue
13 |
14 |     round_(np.random.rand(5, 5), 2)
   |     ^^^^^^ NPY003
15 |     product(np.random.rand(5, 5))
16 |     cumproduct(np.random.rand(5, 5))
   |
   = help: Replace with `np.round`

ℹ Safe fix
   1  |+from numpy import round
1  2  | def func():
2  3  |     import numpy as np
3  4  | 
--------------------------------------------------------------------------------
11 12 | def func():
12 13 |     from numpy import round_, product, cumproduct, sometrue, alltrue
13 14 | 
14    |-    round_(np.random.rand(5, 5), 2)
   15 |+    round(np.random.rand(5, 5), 2)
15 16 |     product(np.random.rand(5, 5))
16 17 |     cumproduct(np.random.rand(5, 5))
17 18 |     sometrue(np.random.rand(5, 5))

NPY003.py:15:5: NPY003 [*] `np.product` is deprecated; use `np.prod` instead
   |
14 |     round_(np.random.rand(5, 5), 2)
15 |     product(np.random.rand(5, 5))
   |     ^^^^^^^ NPY003
16 |     cumproduct(np.random.rand(5, 5))
17 |     sometrue(np.random.rand(5, 5))
   |
   = help: Replace with `np.prod`

ℹ Safe fix
   1  |+from numpy import prod
1  2  | def func():
2  3  |     import numpy as np
3  4  | 
--------------------------------------------------------------------------------
12 13 |     from numpy import round_, product, cumproduct, sometrue, alltrue
13 14 | 
14 15 |     round_(np.random.rand(5, 5), 2)
15    |-    product(np.random.rand(5, 5))
   16 |+    prod(np.random.rand(5, 5))
16 17 |     cumproduct(np.random.rand(5, 5))
17 18 |     sometrue(np.random.rand(5, 5))
18 19 |     alltrue(np.random.rand(5, 5))

NPY003.py:16:5: NPY003 [*] `np.cumproduct` is deprecated; use `np.cumprod` instead
   |
14 |     round_(np.random.rand(5, 5), 2)
15 |     product(np.random.rand(5, 5))
16 |     cumproduct(np.random.rand(5, 5))
   |     ^^^^^^^^^^ NPY003
17 |     sometrue(np.random.rand(5, 5))
18 |     alltrue(np.random.rand(5, 5))
   |
   = help: Replace with `np.cumprod`

ℹ Safe fix
   1  |+from numpy import cumprod
1  2  | def func():
2  3  |     import numpy as np
3  4  | 
--------------------------------------------------------------------------------
13 14 | 
14 15 |     round_(np.random.rand(5, 5), 2)
15 16 |     product(np.random.rand(5, 5))
16    |-    cumproduct(np.random.rand(5, 5))
   17 |+    cumprod(np.random.rand(5, 5))
17 18 |     sometrue(np.random.rand(5, 5))
18 19 |     alltrue(np.random.rand(5, 5))

NPY003.py:17:5: NPY003 [*] `np.sometrue` is deprecated; use `np.any` instead
   |
15 |     product(np.random.rand(5, 5))
16 |     cumproduct(np.random.rand(5, 5))
17 |     sometrue(np.random.rand(5, 5))
   |     ^^^^^^^^ NPY003
18 |     alltrue(np.random.rand(5, 5))
   |
   = help: Replace with `np.any`

ℹ Safe fix
   1  |+from numpy import any
1  2  | def func():
2  3  |     import numpy as np
3  4  | 
--------------------------------------------------------------------------------
14 15 |     round_(np.random.rand(5, 5), 2)
15 16 |     product(np.random.rand(5, 5))
16 17 |     cumproduct(np.random.rand(5, 5))
17    |-    sometrue(np.random.rand(5, 5))
   18 |+    any(np.random.rand(5, 5))
18 19 |     alltrue(np.random.rand(5, 5))

NPY003.py:18:5: NPY003 [*] `np.alltrue` is deprecated; use `np.all` instead
   |
16 |     cumproduct(np.random.rand(5, 5))
17 |     sometrue(np.random.rand(5, 5))
18 |     alltrue(np.random.rand(5, 5))
   |     ^^^^^^^ NPY003
   |
   = help: Replace with `np.all`

ℹ Safe fix
   1  |+from numpy import all
1  2  | def func():
2  3  |     import numpy as np
3  4  | 
--------------------------------------------------------------------------------
15 16 |     product(np.random.rand(5, 5))
16 17 |     cumproduct(np.random.rand(5, 5))
17 18 |     sometrue(np.random.rand(5, 5))
18    |-    alltrue(np.random.rand(5, 5))
   19 |+    all(np.random.rand(5, 5))
