Skip to content
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

API: Add extension type registry to API #22664

Closed
TomAugspurger opened this issue Sep 11, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@TomAugspurger
Copy link
Contributor

commented Sep 11, 2018

In pandas.api.extensions probably.

@TomAugspurger

This comment has been minimized.

Copy link
Contributor Author

commented Sep 11, 2018

Actually, I prefer something like

def register(cls):
    """Class decorator to register an ExtensionType with pandas.

    This enables operations like ``.astype(name)`` for the name
    of the ExtensionDtype.

    Examples
    --------
    >>> from pandas.api.extensions import register, ExtensionDtype
    >>> @register
    ... class MyExtensionDtype(ExtensionDtype):
    ...     pass
    """
    registry.register(cls)
    return cls

That gives us a bit more freedom in changing how registry is implemented.

@TomAugspurger TomAugspurger added this to the 0.24.0 milestone Sep 11, 2018

TomAugspurger added a commit to TomAugspurger/pandas that referenced this issue Sep 11, 2018

TomAugspurger added a commit to TomAugspurger/pandas that referenced this issue Sep 11, 2018

TomAugspurger added a commit to TomAugspurger/pandas that referenced this issue Sep 11, 2018

Squashed commit of the following:
commit 9b646e2
Author: Tom Augspurger <tom.w.augspurger@gmail.com>
Date:   Tue Sep 11 14:07:15 2018 -0500

    Doc fixup

commit b1aac08
Author: Tom Augspurger <tom.w.augspurger@gmail.com>
Date:   Tue Sep 11 13:57:18 2018 -0500

    API: register_extension_dtype class decorator

    Closes pandas-dev#22664
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.