Skip to content

Fix docs for api.types #59753

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

Merged
merged 7 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Timestamp.tzinfo GL08" \
-i "pandas.Timestamp.year GL08" \
-i "pandas.api.extensions.ExtensionArray.interpolate PR01,SA01" \
-i "pandas.api.types.is_bool PR01,SA01" \
-i "pandas.api.types.is_categorical_dtype SA01" \
-i "pandas.api.types.is_complex PR01,SA01" \
-i "pandas.api.types.is_complex_dtype SA01" \
-i "pandas.api.types.is_datetime64_dtype SA01" \
-i "pandas.api.types.is_datetime64_ns_dtype SA01" \
-i "pandas.api.types.is_datetime64tz_dtype SA01" \
-i "pandas.api.types.is_dict_like PR07,SA01" \
-i "pandas.api.types.is_extension_array_dtype SA01" \
-i "pandas.api.types.is_file_like PR07,SA01" \
Expand Down
23 changes: 23 additions & 0 deletions pandas/_libs/lib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1123,10 +1123,21 @@ def is_bool(obj: object) -> bool:
"""
Return True if given object is boolean.

Parameters
----------
obj : object
Object to check.

Returns
-------
bool

See Also
--------
api.types.is_scalar : Check if the input is a scalar.
api.types.is_integer : Check if the input is an integer.
api.types.is_float : Check if the input is a float.

Examples
--------
>>> pd.api.types.is_bool(True)
Expand All @@ -1142,10 +1153,22 @@ def is_complex(obj: object) -> bool:
"""
Return True if given object is complex.

Parameters
----------
obj : object
Object to check.

Returns
-------
bool

See Also
--------
api.types.is_complex_dtype: Check whether the provided array or
dtype is of a complex dtype.
api.types.is_number: Check if the object is a number.
api.types.is_integer: Return True if given object is integer.

Examples
--------
>>> pd.api.types.is_complex(1 + 1j)
Expand Down
35 changes: 35 additions & 0 deletions pandas/core/dtypes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,13 @@ def is_datetime64_dtype(arr_or_dtype) -> bool:
boolean
Whether or not the array-like or dtype is of the datetime64 dtype.

See Also
--------
api.types.is_datetime64_ns_dtype: Check whether the provided array or
dtype is of the datetime64[ns] dtype.
api.types.is_datetime64_any_dtype: Check whether the provided array or
dtype is of the datetime64 dtype.

Examples
--------
>>> from pandas.api.types import is_datetime64_dtype
Expand Down Expand Up @@ -316,6 +323,13 @@ def is_datetime64tz_dtype(arr_or_dtype) -> bool:
boolean
Whether or not the array-like or dtype is of a DatetimeTZDtype dtype.

See Also
--------
api.types.is_datetime64_dtype: Check whether an array-like or
dtype is of the datetime64 dtype.
api.types.is_datetime64_any_dtype: Check whether the provided array or
dtype is of the datetime64 dtype.

Examples
--------
>>> from pandas.api.types import is_datetime64tz_dtype
Expand Down Expand Up @@ -514,6 +528,12 @@ def is_categorical_dtype(arr_or_dtype) -> bool:
boolean
Whether or not the array-like or dtype is of the Categorical dtype.

See Also
--------
api.types.is_list_like: Check if the object is list-like.
api.types.is_complex_dtype: Check whether the provided array or
dtype is of a complex dtype.

Examples
--------
>>> from pandas.api.types import is_categorical_dtype
Expand Down Expand Up @@ -977,6 +997,13 @@ def is_datetime64_ns_dtype(arr_or_dtype) -> bool:
bool
Whether or not the array or dtype is of the datetime64[ns] dtype.

See Also
--------
api.types.is_datetime64_dtype: Check whether an array-like or
dtype is of the datetime64 dtype.
api.types.is_datetime64_any_dtype: Check whether the provided array or
dtype is of the datetime64 dtype.

Examples
--------
>>> from pandas.api.types import is_datetime64_ns_dtype
Expand Down Expand Up @@ -1436,6 +1463,14 @@ def is_complex_dtype(arr_or_dtype) -> bool:
boolean
Whether or not the array or dtype is of a complex dtype.

See Also
--------
api.types.is_complex: Return True if given object is complex.
api.types.is_numeric_dtype: Check whether the provided array or
dtype is of a numeric dtype.
api.types.is_integer_dtype: Check whether the provided array or
dtype is of an integer dtype.

Examples
--------
>>> from pandas.api.types import is_complex_dtype
Expand Down