From 0adfda368c7531aed82fc89f6defd129abebe683 Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Sun, 29 Sep 2024 20:58:45 +0530 Subject: [PATCH] DOC: add PR07,SA01 for pandas.api.types.is_dict_like --- ci/code_checks.sh | 1 - pandas/core/dtypes/inference.py | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index b65dcedbd8a10..88075e5e42880 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -107,7 +107,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Timestamp.resolution PR02" \ -i "pandas.Timestamp.tzinfo GL08" \ -i "pandas.Timestamp.year GL08" \ - -i "pandas.api.types.is_dict_like PR07,SA01" \ -i "pandas.api.types.is_file_like PR07,SA01" \ -i "pandas.api.types.is_float PR01,SA01" \ -i "pandas.api.types.is_hashable PR01,RT03,SA01" \ diff --git a/pandas/core/dtypes/inference.py b/pandas/core/dtypes/inference.py index f042911b53d2b..ebd87d5c426ce 100644 --- a/pandas/core/dtypes/inference.py +++ b/pandas/core/dtypes/inference.py @@ -273,14 +273,24 @@ def is_dict_like(obj: object) -> bool: """ Check if the object is dict-like. + This function checks if the input object has dictionary-like behavior, + specifically if it implements methods like ``__getitem__``, ``keys``, and + ``__contains__``. + Parameters ---------- - obj : The object to check + obj : object + The object to check for dict-like behavior. Returns ------- bool - Whether `obj` has dict-like properties. + Whether ``obj`` has dict-like properties. + + See Also + -------- + api.types.is_list_like : Check if the object is list-like. + api.types.is_scalar : Return True if given object is scalar. Examples --------