Skip to content

API: Add extension type registry to API #22664

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

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

API: Add extension type registry to API #22664

TomAugspurger opened this issue Sep 11, 2018 · 1 comment
Labels
ExtensionArray Extending pandas with custom dtypes or arrays.
Milestone

Comments

@TomAugspurger
Copy link
Contributor

In pandas.api.extensions probably.

@TomAugspurger TomAugspurger added the ExtensionArray Extending pandas with custom dtypes or arrays. label Sep 11, 2018
@TomAugspurger
Copy link
Contributor Author

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
commit 9b646e2
Author: Tom Augspurger <[email protected]>
Date:   Tue Sep 11 14:07:15 2018 -0500

    Doc fixup

commit b1aac08
Author: Tom Augspurger <[email protected]>
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
Labels
ExtensionArray Extending pandas with custom dtypes or arrays.
Projects
None yet
Development

No branches or pull requests

1 participant