@@ -113,13 +113,24 @@ def is_file_like(obj: object) -> bool:
113
113
114
114
Parameters
115
115
----------
116
- obj : The object to check
116
+ obj : object
117
+ The object to check for file-like properties.
118
+ This can be any Python object, and the function will
119
+ check if it has attributes typically associated with
120
+ file-like objects (e.g., `read`, `write`, `__iter__`).
117
121
118
122
Returns
119
123
-------
120
124
bool
121
125
Whether `obj` has file-like properties.
122
126
127
+ See Also
128
+ --------
129
+ api.types.is_dict_like : Check if the object is dict-like.
130
+ api.types.is_hashable : Return True if hash(obj) will succeed, False otherwise.
131
+ api.types.is_named_tuple : Check if the object is a named tuple.
132
+ api.types.is_iterator : Check if the object is an iterator.
133
+
123
134
Examples
124
135
--------
125
136
>>> import io
@@ -142,13 +153,24 @@ def is_re(obj: object) -> TypeGuard[Pattern]:
142
153
143
154
Parameters
144
155
----------
145
- obj : The object to check
156
+ obj : object
157
+ The object to check for being a regex pattern. Typically,
158
+ this would be an object that you expect to be a compiled
159
+ pattern from the `re` module.
146
160
147
161
Returns
148
162
-------
149
163
bool
150
164
Whether `obj` is a regex pattern.
151
165
166
+ See Also
167
+ --------
168
+ api.types.is_float : Return True if given object is float.
169
+ api.types.is_iterator : Check if the object is an iterator.
170
+ api.types.is_integer : Return True if given object is integer.
171
+ api.types.is_re_compilable : Check if the object can be compiled
172
+ into a regex pattern instance.
173
+
152
174
Examples
153
175
--------
154
176
>>> from pandas.api.types import is_re
@@ -275,13 +297,22 @@ def is_dict_like(obj: object) -> bool:
275
297
276
298
Parameters
277
299
----------
278
- obj : The object to check
300
+ obj : object
301
+ The object to check. This can be any Python object,
302
+ and the function will determine whether it
303
+ behaves like a dictionary.
279
304
280
305
Returns
281
306
-------
282
307
bool
283
308
Whether `obj` has dict-like properties.
284
309
310
+ See Also
311
+ --------
312
+ api.types.is_list_like : Check if the object is list-like.
313
+ api.types.is_file_like : Check if the object is a file-like.
314
+ api.types.is_named_tuple : Check if the object is a named tuple.
315
+
285
316
Examples
286
317
--------
287
318
>>> from pandas.api.types import is_dict_like
@@ -308,13 +339,22 @@ def is_named_tuple(obj: object) -> bool:
308
339
309
340
Parameters
310
341
----------
311
- obj : The object to check
342
+ obj : object
343
+ The object that will be checked to determine
344
+ whether it is a named tuple.
312
345
313
346
Returns
314
347
-------
315
348
bool
316
349
Whether `obj` is a named tuple.
317
350
351
+ See Also
352
+ --------
353
+ api.types.is_dict_like: Check if the object is dict-like.
354
+ api.types.is_hashable: Return True if hash(obj)
355
+ will succeed, False otherwise.
356
+ api.types.is_categorical_dtype : Check if the dtype is categorical.
357
+
318
358
Examples
319
359
--------
320
360
>>> from collections import namedtuple
@@ -340,9 +380,24 @@ def is_hashable(obj: object) -> TypeGuard[Hashable]:
340
380
Distinguish between these and other types by trying the call to hash() and
341
381
seeing if they raise TypeError.
342
382
383
+ Parameters
384
+ ----------
385
+ obj : object
386
+ The object to check for hashability. Any Python object can be passed here.
387
+
343
388
Returns
344
389
-------
345
390
bool
391
+ True if object can be hashed (i.e., does not raise TypeError when
392
+ passed to hash()), and False otherwise (e.g., if object is mutable
393
+ like a list or dictionary).
394
+
395
+ See Also
396
+ --------
397
+ api.types.is_float : Return True if given object is float.
398
+ api.types.is_iterator : Check if the object is an iterator.
399
+ api.types.is_list_like : Check if the object is list-like.
400
+ api.types.is_dict_like : Check if the object is dict-like.
346
401
347
402
Examples
348
403
--------
0 commit comments