@@ -29,39 +29,41 @@ It is now possible to create an index of any numpy int/uint/float dtype using th
29
29
pd.NumericIndex([1 , 2 , 3 ], dtype = " uint32" )
30
30
pd.NumericIndex([1 , 2 , 3 ], dtype = " float32" )
31
31
32
- In order to maintain backwards compatibility, calls to the base :class: `Index ` will in
33
- pandas 1.x. return :class: `Int64Index `, :class: `UInt64Index ` and :class: `Float64Index `.
32
+ In order to maintain backwards compatibility, calls to the base :class: `Index ` will currently
33
+ return :class: `Int64Index `, :class: `UInt64Index ` and :class: `Float64Index `, where relevant .
34
34
For example, the code below returns an ``Int64Index `` with dtype ``int64 ``:
35
35
36
36
.. code-block :: ipython
37
37
38
38
In [1]: pd.Index([1, 2, 3], dtype="int8")
39
39
Int64Index([1, 2, 3], dtype='int64')
40
40
41
- For the duration of Pandas 1.x, in order to maintain backwards compatibility, all
42
- operations that until now have returned :class: `Int64Index `, :class: `UInt64Index ` and
43
- :class: `Float64Index ` will continue to so. This means, that in order to use
44
- ``NumericIndex ``, you will have to call ``NumericIndex `` explicitly. For example the below series
45
- will have an ``Int64Index ``:
41
+ but will in a future version return a :class: `NumericIndex ` with dtype ``int8 ``.
42
+
43
+ More generally, currently, all operations that until now have
44
+ returned :class: `Int64Index `, :class: `UInt64Index ` and :class: `Float64Index ` will
45
+ continue to so. This means, that in order to use ``NumericIndex `` in the current version, you
46
+ will have to call ``NumericIndex `` explicitly. For example the below series will have an ``Int64Index ``:
46
47
47
48
.. code-block :: ipython
48
49
49
50
In [2]: ser = pd.Series([1, 2, 3], index=[1, 2, 3])
50
51
In [3]: ser.index
51
52
Int64Index([1, 2, 3], dtype='int64')
52
53
53
- Instead if you want to use a ``NumericIndex ``, you should do:
54
+ Instead, if you want to use a ``NumericIndex ``, you should do:
54
55
55
56
.. ipython :: python
56
57
57
58
idx = pd.NumericIndex([1 , 2 , 3 ], dtype = " int8" )
58
59
ser = pd.Series([1 , 2 , 3 ], index = idx)
59
60
ser.index
60
61
61
- In Pandas 2.0, :class: `NumericIndex ` will become the default numeric index type and
62
- ``Int64Index ``, ``UInt64Index `` and ``Float64Index `` will be removed.
62
+ In a future version of Pandas, :class: `NumericIndex ` will become the default numeric index type and
63
+ ``Int64Index ``, ``UInt64Index `` and ``Float64Index `` are therefore deprecated and will
64
+ be removed in the future, see :ref: `here <whatsnew_140.deprecations.int64_uint64_float64index >` for more.
63
65
64
- See :ref: `here <advanced.numericindex >` for more.
66
+ See :ref: `here <advanced.numericindex >` for more about :class: ` NumericIndex ` .
65
67
66
68
.. _whatsnew_140.enhancements.styler :
67
69
@@ -224,6 +226,41 @@ Other API changes
224
226
225
227
Deprecations
226
228
~~~~~~~~~~~~
229
+
230
+ .. _whatsnew_140.deprecations.int64_uint64_float64index :
231
+
232
+ Deprecated Int64Index, UInt64Index & Float64Index
233
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
234
+ :class: `Int64Index `, :class: `UInt64Index ` and :class: `Float64Index ` have been deprecated
235
+ in favor of the new :class: `NumericIndex ` and will be removed in Pandas 2.0 (:issue: `43028 `).
236
+
237
+ Currently, in order to maintain backward compatibility, calls to
238
+ :class: `Index ` will continue to return :class: `Int64Index `, :class: `UInt64Index ` and :class: `Float64Index `
239
+ when given numeric data, but in the future, a :class: `NumericIndex ` will be returned.
240
+
241
+ *Current behavior *:
242
+
243
+ .. code-block :: ipython
244
+
245
+ In [1]: pd.Index([1, 2, 3], dtype="int32")
246
+ Out [1]: Int64Index([1, 2, 3], dtype='int64')
247
+ In [1]: pd.Index([1, 2, 3], dtype="uint64")
248
+ Out [1]: UInt64Index([1, 2, 3], dtype='uint64')
249
+
250
+ *Future behavior *:
251
+
252
+ .. code-block :: ipython
253
+
254
+ In [3]: pd.Index([1, 2, 3], dtype="int32")
255
+ Out [3]: NumericIndex([1, 2, 3], dtype='int32')
256
+ In [4]: pd.Index([1, 2, 3], dtype="uint64")
257
+ Out [4]: NumericIndex([1, 2, 3], dtype='uint64')
258
+
259
+
260
+ .. _whatsnew_140.deprecations.other :
261
+
262
+ Other Deprecations
263
+ ^^^^^^^^^^^^^^^^^^
227
264
- Deprecated :meth: `Index.is_type_compatible ` (:issue: `42113 `)
228
265
- Deprecated ``method `` argument in :meth: `Index.get_loc `, use ``index.get_indexer([label], method=...) `` instead (:issue: `42269 `)
229
266
- Deprecated treating integer keys in :meth: `Series.__setitem__ ` as positional when the index is a :class: `Float64Index ` not containing the key, a :class: `IntervalIndex ` with no entries containing the key, or a :class: `MultiIndex ` with leading :class: `Float64Index ` level not containing the key (:issue: `33469 `)
0 commit comments