| [ Web Proxy ] |
| Viewing: https://arrow.apache.org/docs/python/api/../generated/pyarrow.unregister_extension_type.html | [Back] [Original] |
Section Navigation
Unregister a Python extension type.
strThe name of the ExtensionType subclass to unregister.
Examples
Define a RationalType extension type subclassing ExtensionType:
>>> import pyarrow as pa
>>> class RationalType(pa.ExtensionType):
... def __init__(self, data_type: pa.DataType):
... if not pa.types.is_integer(data_type):
... raise TypeError(f"data_type must be an integer type not {data_type}")
... super().__init__(
... pa.struct(
... [
... ("numer", data_type),
... ("denom", data_type),
... ],
... ),
... # N.B. This name does _not_ reference `data_type` so deserialization
... # will work for _any_ integer `data_type` after registration
... "my_package.rational",
... )
... def __arrow_ext_serialize__(self) -> bytes:
... # No parameters are necessary
... return b""
... @classmethod
... def __arrow_ext_deserialize__(cls, storage_type, serialized):
... # return an instance of this subclass
... return RationalType(storage_type[0].type)
Register the extension type:
>>> pa.register_extension_type(RationalType(pa.int64()))
Unregister the extension type:
>>> pa.unregister_extension_type("my_package.rational")
Copyright 2016-2026 Apache Software Foundation.
Apache Arrow, Arrow, Apache, the Apache logo, and the Apache Arrow project logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.
Created using Sphinx 9.1.0.
Built with the PyData Sphinx Theme 0.20.0.
| Web Proxy Viewer | New URL | Original Page |