Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

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 theUse Guide for more.

Parameters:
arr_or_dtypeobject

For array-like input, the.dtype attribute willbe extracted.

Returns:
bool

Whether thearr_or_dtype is an extension array type.

Notes

This checks whether an object implements the pandas extensionarray interface. In pandas, this includes:

  • Categorical

  • Sparse

  • Interval

  • Period

  • DatetimeArray

  • TimedeltaArray

Third-party libraries may implement arrays or types satisfyingthis interface as well.

Examples

>>>frompandas.api.typesimportis_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

[8]ページ先頭

©2009-2025 Movatter.jp