Skip to content

Commit ff86177

Browse files
authored
ENH: Reflect changes from numpy namespace refactor Part 3 (#54579)
* ENH: Reflect changes from numpy namespace refactor part 3 * ENH: Move to fixtures for dtype access
1 parent b6333e6 commit ff86177

File tree

102 files changed

+280
-283
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+280
-283
lines changed

asv_bench/benchmarks/algos/isin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def setup(self, series_type, vals_type):
247247
elif series_type == "long":
248248
ser_vals = np.arange(N_many)
249249
elif series_type == "long_floats":
250-
ser_vals = np.arange(N_many, dtype=np.float_)
250+
ser_vals = np.arange(N_many, dtype=np.float64)
251251

252252
self.series = Series(ser_vals).astype(object)
253253

@@ -258,7 +258,7 @@ def setup(self, series_type, vals_type):
258258
elif vals_type == "long":
259259
values = np.arange(N_many)
260260
elif vals_type == "long_floats":
261-
values = np.arange(N_many, dtype=np.float_)
261+
values = np.arange(N_many, dtype=np.float64)
262262

263263
self.values = values.astype(object)
264264

doc/source/getting_started/comparison/comparison_with_sql.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ methods.
107107
.. ipython:: python
108108
109109
frame = pd.DataFrame(
110-
{"col1": ["A", "B", np.NaN, "C", "D"], "col2": ["F", np.NaN, "G", "H", "I"]}
110+
{"col1": ["A", "B", np.nan, "C", "D"], "col2": ["F", np.nan, "G", "H", "I"]}
111111
)
112112
frame
113113

doc/source/user_guide/enhancingperf.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ can be improved by passing an ``np.ndarray``.
183183
...: return s * dx
184184
...: cpdef np.ndarray[double] apply_integrate_f(np.ndarray col_a, np.ndarray col_b,
185185
...: np.ndarray col_N):
186-
...: assert (col_a.dtype == np.float_
187-
...: and col_b.dtype == np.float_ and col_N.dtype == np.int_)
186+
...: assert (col_a.dtype == np.float64
187+
...: and col_b.dtype == np.float64 and col_N.dtype == np.int_)
188188
...: cdef Py_ssize_t i, n = len(col_N)
189189
...: assert (len(col_a) == len(col_b) == n)
190190
...: cdef np.ndarray[double] res = np.empty(n)

doc/source/user_guide/gotchas.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ present in the more domain-specific statistical programming language `R
327327
``numpy.unsignedinteger`` | ``uint8, uint16, uint32, uint64``
328328
``numpy.object_`` | ``object_``
329329
``numpy.bool_`` | ``bool_``
330-
``numpy.character`` | ``string_, unicode_``
330+
``numpy.character`` | ``bytes_, str_``
331331

332332
The R language, by contrast, only has a handful of built-in data types:
333333
``integer``, ``numeric`` (floating-point), ``character``, and

doc/source/user_guide/io.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4881,7 +4881,7 @@ unspecified columns of the given DataFrame. The argument ``selector``
48814881
defines which table is the selector table (which you can make queries from).
48824882
The argument ``dropna`` will drop rows from the input ``DataFrame`` to ensure
48834883
tables are synchronized. This means that if a row for one of the tables
4884-
being written to is entirely ``np.NaN``, that row will be dropped from all tables.
4884+
being written to is entirely ``np.nan``, that row will be dropped from all tables.
48854885

48864886
If ``dropna`` is False, **THE USER IS RESPONSIBLE FOR SYNCHRONIZING THE TABLES**.
48874887
Remember that entirely ``np.Nan`` rows are not written to the HDFStore, so if

doc/source/whatsnew/v0.24.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ You must pass in the ``line_terminator`` explicitly, even in this case.
556556
557557
.. _whatsnew_0240.bug_fixes.nan_with_str_dtype:
558558

559-
Proper handling of ``np.NaN`` in a string data-typed column with the Python engine
559+
Proper handling of ``np.nan`` in a string data-typed column with the Python engine
560560
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
561561

562562
There was bug in :func:`read_excel` and :func:`read_csv` with the Python

pandas/_libs/algos.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ from pandas._libs.util cimport get_nat
5959

6060
cdef:
6161
float64_t FP_ERR = 1e-13
62-
float64_t NaN = <float64_t>np.NaN
62+
float64_t NaN = <float64_t>np.nan
6363
int64_t NPY_NAT = get_nat()
6464

6565

pandas/_libs/groupby.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ from pandas._libs.missing cimport checknull
5252

5353
cdef int64_t NPY_NAT = util.get_nat()
5454

55-
cdef float64_t NaN = <float64_t>np.NaN
55+
cdef float64_t NaN = <float64_t>np.nan
5656

5757
cdef enum InterpolationEnumType:
5858
INTERPOLATION_LINEAR,

pandas/_libs/lib.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ cdef:
144144
object oINT64_MIN = <int64_t>INT64_MIN
145145
object oUINT64_MAX = <uint64_t>UINT64_MAX
146146

147-
float64_t NaN = <float64_t>np.NaN
147+
float64_t NaN = <float64_t>np.nan
148148

149149
# python-visible
150150
i8max = <int64_t>INT64_MAX

pandas/_libs/tslibs/util.pxd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ cdef inline bint is_integer_object(object obj) noexcept nogil:
7575

7676
cdef inline bint is_float_object(object obj) noexcept nogil:
7777
"""
78-
Cython equivalent of `isinstance(val, (float, np.float_))`
78+
Cython equivalent of `isinstance(val, (float, np.float64))`
7979
8080
Parameters
8181
----------
@@ -91,7 +91,7 @@ cdef inline bint is_float_object(object obj) noexcept nogil:
9191

9292
cdef inline bint is_complex_object(object obj) noexcept nogil:
9393
"""
94-
Cython equivalent of `isinstance(val, (complex, np.complex_))`
94+
Cython equivalent of `isinstance(val, (complex, np.complex128))`
9595
9696
Parameters
9797
----------

0 commit comments

Comments
 (0)