Skip to content

Commit

Permalink
remove version numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
topper-123 committed Aug 20, 2021
1 parent cd817a0 commit 60d16df
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
16 changes: 8 additions & 8 deletions doc/source/user_guide/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -854,9 +854,9 @@ Int64Index and RangeIndex
.. deprecated:: 1.4.0
In pandas 2.0, :class:`NumericIndex` will become the default index type for numeric types
instead of ``Int64Index``, ``Float64Index`` and ``UInt64Index`` and those index types
are therefore deprecated and will be removed in Pandas 2.0.
are therefore deprecated and will be removed in a futire version.
See :ref:`here <advanced.numericindex>` for more.
``RangeIndex`` however, will not be removed, as it represents an optimized version of an integer index.
``RangeIndex`` will not be removed, as it represents an optimized version of an integer index.

:class:`Int64Index` is a fundamental basic index in pandas. This is an immutable array
implementing an ordered, sliceable set.
Expand All @@ -870,11 +870,11 @@ Float64Index
~~~~~~~~~~~~

.. deprecated:: 1.4.0
In pandas 2.0, :class:`NumericIndex` will become the default index type for numeric types
:class:`NumericIndex` will become the default index type for numeric types in the future
instead of ``Int64Index``, ``Float64Index`` and ``UInt64Index`` and those index types
are therefore deprecated and will be removed in Pandas 2.0.
are therefore deprecated and will be removed in a future version of Pandas.
See :ref:`here <advanced.numericindex>` for more.
``RangeIndex`` however, will not be removed, as it represents an optimized version of an integer index.
``RangeIndex`` will not be removed as it represents an optimized version of an integer index.

By default a :class:`Float64Index` will be automatically created when passing floating, or mixed-integer-floating values in index creation.
This enables a pure label-based slicing paradigm that makes ``[],ix,loc`` for scalar indexing and slicing work exactly the
Expand Down Expand Up @@ -982,8 +982,8 @@ NumericIndex

In pandas 2.0, :class:`NumericIndex` will become the default index type for numeric types
instead of :class:`Int64Index`, :class:`Float64Index` and :class:`UInt64Index` and those index types
are therefore deprecated and will be removed in Pandas 2.0.
:class:`RangeIndex` however, will not be removed, as it represents an optimized version of an integer index.
are therefore deprecated and will be removed in a futureversion.
:class:`RangeIndex` will not be removed as it represents an optimized version of an integer index.

:class:`NumericIndex` is an index type that can hold data of any numpy int/uint/float dtype. For example:

Expand All @@ -998,7 +998,7 @@ NumericIndex
``UInt64Index`` except that it can hold any numpy int, uint or float dtype.

Until Pandas 2.0, you will have to call ``NumericIndex`` explicitly in order to use it, like in the example above.
In Pandas 2.0, ``NumericIndex`` will become the default pandas numeric index type and will automatically be used where appropriate.
In the future, ``NumericIndex`` will become the default pandas numeric index type and will automatically be used where appropriate.

Please notice that ``NumericIndex`` *can not* hold Pandas numeric dtypes (:class:`Int64Dtype`, :class:`Int32Dtype` etc.).

Expand Down
20 changes: 10 additions & 10 deletions doc/source/whatsnew/v1.4.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ It is now possible to create an index of any numpy int/uint/float dtype using th
pd.NumericIndex([1, 2, 3], dtype="uint32")
pd.NumericIndex([1, 2, 3], dtype="float32")
In order to maintain backwards compatibility, calls to the base :class:`Index` will in
pandas 1.x. return :class:`Int64Index`, :class:`UInt64Index` and :class:`Float64Index`, where relevant.
In order to maintain backwards compatibility, calls to the base :class:`Index` will currently
return :class:`Int64Index`, :class:`UInt64Index` and :class:`Float64Index`, where relevant.
For example, the code below returns an ``Int64Index`` with dtype ``int64``:

.. code-block:: ipython
In [1]: pd.Index([1, 2, 3], dtype="int8")
Int64Index([1, 2, 3], dtype='int64')
but will in Pandas 2.0 return a :class:`NumericIndex` with dtype ``int8``.
but will in a future version return a :class:`NumericIndex` with dtype ``int8``.

More generally, for the duration of Pandas 1.x, all operations that until now have
More generally, currently, all operations that until now have
returned :class:`Int64Index`, :class:`UInt64Index` and :class:`Float64Index` will
continue to so. This means, that in order to use ``NumericIndex`` in Pandas 1.x, you
continue to so. This means, that in order to use ``NumericIndex`` in the current version, you
will have to call ``NumericIndex`` explicitly. For example the below series will have an ``Int64Index``:

.. code-block:: ipython
Expand All @@ -51,17 +51,17 @@ will have to call ``NumericIndex`` explicitly. For example the below series will
In [3]: ser.index
Int64Index([1, 2, 3], dtype='int64')
Instead, if you want to use a ``NumericIndex`` in Pandas 1.x, you should do:
Instead, if you want to use a ``NumericIndex``, you should do:

.. ipython:: python
idx = pd.NumericIndex([1, 2, 3], dtype="int8")
ser = pd.Series([1, 2, 3], index=idx)
ser.index
In Pandas 2.0, :class:`NumericIndex` will become the default numeric index type and
In a future version of Pandas, :class:`NumericIndex` will become the default numeric index type and
``Int64Index``, ``UInt64Index`` and ``Float64Index`` are therefore deprecated and will
be removed in pandas 2.0, see :ref:`here <whatsnew_140.deprecations.int64_uint64_float64index>` for more.
be removed in the future, see :ref:`here <whatsnew_140.deprecations.int64_uint64_float64index>` for more.

See :ref:`here <advanced.numericindex>` for more about :class:`NumericIndex`.

Expand Down Expand Up @@ -209,9 +209,9 @@ Deprecated Int64Index, UInt64Index & Float64Index
:class:`Int64Index`, :class:`UInt64Index` and :class:`Float64Index` have been deprecated
in favor of the new :class:`NumericIndex` and will be removed in Pandas 2.0 (:issue:`43028`).

For the duration of Pandas 1.x, in order to maintain backward compatibility, calls to
Currently, in order to maintain backward compatibility, calls to
:class:`Index` will continue to return :class:`Int64Index`, :class:`UInt64Index` and :class:`Float64Index`
when given numeric data, but in Pandas 2.0, a :class:`NumericIndex` will be returned.
when given numeric data, but in the future, a :class:`NumericIndex` will be returned.

*Current behavior*:

Expand Down
3 changes: 3 additions & 0 deletions pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@


def __dir__():
# GH43028
# Int64Index etc. are deprecated, but we still want them to be available in the dir.
# Remove in Pandas 2.0, when we remove Int64Index etc. from the code base.
return list(globals().keys()) + __deprecated_num_index_names


Expand Down

0 comments on commit 60d16df

Please sign in to comment.