Skip to content

DEPR: subclassing Index #52186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 29, 2023
Merged

Conversation

jbrockmendel
Copy link
Member

This is just a docs change, removing the wording that suggests we explicitly support subclassing Index. So it shouldn't break any implementations in the wild.

@@ -31,32 +31,6 @@ There are functions that make the creation of a regular index easy:
* :func:`period_range`: fixed frequency date range generated from a time rule or
DateOffset. An ndarray of :class:`Period` objects, representing timespans

The motivation for having an ``Index`` class in the first place was to enable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to add a .. warning:: block here noting that subclassing an Index is not officially supported and users should use the extension array interface instead

@mroeschke mroeschke added Docs Deprecate Functionality to remove in pandas Index Related to the Index class or subclasses labels Mar 27, 2023
* :meth:`~Index.delete`: Delete a label, yielding a new object
* :meth:`~Index.drop`: Deletes a set of labels
* :meth:`~Index.take`: Analogous to ndarray.take
.. warning:: Custom :class:`Index` subclasses are not supported, custom behavior should
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc build is failing since the note should start on a new line and indented (similar to .. note:: blocks)

@mroeschke mroeschke added this to the 2.1 milestone Mar 29, 2023
@mroeschke mroeschke merged commit 2105e81 into pandas-dev:main Mar 29, 2023
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the depr-index-subclassing branch March 29, 2023 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Docs Index Related to the Index class or subclasses
Projects
None yet
2 participants