---
source: crates/ruff_linter/src/rules/numpy/mod.rs
---
NPY001 [*] Type alias `np.float` is deprecated, replace with builtin type
 --> NPY001.py:6:1
  |
5 | # Error
6 | npy.float
  | ^^^^^^^^^
7 | npy.int
  |
help: Replace `np.float` with builtin type
  |
5 | # Error
  - npy.float
6 + float
7 | npy.int
  |

NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type
 --> NPY001.py:7:1
  |
5 | # Error
6 | npy.float
7 | npy.int
  | ^^^^^^^
8 |
9 | if dtype == np.object:
  |
help: Replace `np.int` with builtin type
  |
6 | npy.float
  - npy.int
7 + int
8 |
  |

NPY001 [*] Type alias `np.object` is deprecated, replace with builtin type
  --> NPY001.py:9:13
   |
 7 | npy.int
 8 |
 9 | if dtype == np.object:
   |             ^^^^^^^^^
10 |     ...
   |
help: Replace `np.object` with builtin type
   |
8  |
   - if dtype == np.object:
9  + if dtype == object:
10 |     ...
   |

NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type
  --> NPY001.py:12:72
   |
10 |     ...
11 |
12 | result = result.select_dtypes([np.byte, np.ubyte, np.short, np.ushort, np.int, np.complex])
   |                                                                        ^^^^^^
13 |
14 | pdf = pd.DataFrame(
   |
help: Replace `np.int` with builtin type
   |
11 |
   - result = result.select_dtypes([np.byte, np.ubyte, np.short, np.ushort, np.int, np.complex])
12 + result = result.select_dtypes([np.byte, np.ubyte, np.short, np.ushort, int, np.complex])
13 |
   |

NPY001 [*] Type alias `np.complex` is deprecated, replace with builtin type
  --> NPY001.py:12:80
   |
10 |     ...
11 |
12 | result = result.select_dtypes([np.byte, np.ubyte, np.short, np.ushort, np.int, np.complex])
   |                                                                                ^^^^^^^^^^
13 |
14 | pdf = pd.DataFrame(
   |
help: Replace `np.complex` with builtin type
   |
11 |
   - result = result.select_dtypes([np.byte, np.ubyte, np.short, np.ushort, np.int, np.complex])
12 + result = result.select_dtypes([np.byte, np.ubyte, np.short, np.ushort, np.int, complex])
13 |
   |

NPY001 [*] Type alias `np.object` is deprecated, replace with builtin type
  --> NPY001.py:17:11
   |
15 |     data=[[1, 2, 3]],
16 |     columns=["a", "b", "c"],
17 |     dtype=numpy.object,
   |           ^^^^^^^^^^^^
18 | )
   |
help: Replace `np.object` with builtin type
   |
16 |     columns=["a", "b", "c"],
   -     dtype=numpy.object,
17 +     dtype=object,
18 | )
   |

NPY001 [*] Type alias `np.int` is deprecated, replace with builtin type
  --> NPY001.py:20:16
   |
18 | )
19 |
20 | _ = arr.astype(np.int)
   |                ^^^^^^
21 |
22 | # Regression test for: https://github.com/astral-sh/ruff/issues/6952
   |
help: Replace `np.int` with builtin type
   |
19 |
   - _ = arr.astype(np.int)
20 + _ = arr.astype(int)
21 |
   |

NPY001 [*] Type alias `np.float` is deprecated, replace with builtin type
  --> NPY001.py:25:1
   |
23 | from numpy import float
24 |
25 | float(1)
   | ^^^^^
   |
help: Replace `np.float` with builtin type
   |
23 | from numpy import float
24 + import builtins
25 |
   - float(1)
26 + builtins.float(1)
   |
