pandas.api.types.is_extension_array_dtype
-
pandas.api.types.is_extension_array_dtype(arr_or_dtype)
[source] -
Check if an object is a pandas extension array type.
See the Use Guide for more.
Parameters: -
arr_or_dtype : object
-
For array-like input, the
.dtype
attribute will be extracted.
Returns: - bool
-
Whether the
arr_or_dtype
is an extension array type.
Notes
This checks whether an object implements the pandas extension array interface. In pandas, this includes:
- Categorical
- Sparse
- Interval
- Period
- DatetimeArray
- TimedeltaArray
Third-party libraries may implement arrays or types satisfying this interface as well.
Examples
>>> from pandas.api.types import is_extension_array_dtype >>> arr = pd.Categorical(['a', 'b']) >>> is_extension_array_dtype(arr) True >>> is_extension_array_dtype(arr.dtype) True
>>> arr = np.array(['a', 'b']) >>> is_extension_array_dtype(arr.dtype) False
-
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.24.2/reference/api/pandas.api.types.is_extension_array_dtype.html