@@ -1348,7 +1348,7 @@ def _format_native_types(
1348
1348
return formatter .get_result_as_array ()
1349
1349
1350
1350
mask = isna (self )
1351
- if not self . is_object ( ) and not quoting :
1351
+ if not is_object_dtype ( self ) and not quoting :
1352
1352
values = np .asarray (self ).astype (str )
1353
1353
else :
1354
1354
values = np .array (self , dtype = object , copy = True )
@@ -2258,7 +2258,7 @@ def is_boolean(self) -> bool:
2258
2258
is_integer : Check if the Index only consists of integers (deprecated).
2259
2259
is_floating : Check if the Index is a floating type (deprecated).
2260
2260
is_numeric : Check if the Index only consists of numeric data.
2261
- is_object : Check if the Index is of the object dtype.
2261
+ is_object : Check if the Index is of the object dtype (deprecated) .
2262
2262
is_categorical : Check if the Index holds categorical data.
2263
2263
is_interval : Check if the Index holds Interval objects (deprecated).
2264
2264
@@ -2302,7 +2302,7 @@ def is_integer(self) -> bool:
2302
2302
is_boolean : Check if the Index only consists of booleans (deprecated).
2303
2303
is_floating : Check if the Index is a floating type (deprecated).
2304
2304
is_numeric : Check if the Index only consists of numeric data.
2305
- is_object : Check if the Index is of the object dtype.
2305
+ is_object : Check if the Index is of the object dtype. (deprecated).
2306
2306
is_categorical : Check if the Index holds categorical data (deprecated).
2307
2307
is_interval : Check if the Index holds Interval objects (deprecated).
2308
2308
@@ -2350,7 +2350,7 @@ def is_floating(self) -> bool:
2350
2350
is_boolean : Check if the Index only consists of booleans (deprecated).
2351
2351
is_integer : Check if the Index only consists of integers (deprecated).
2352
2352
is_numeric : Check if the Index only consists of numeric data.
2353
- is_object : Check if the Index is of the object dtype.
2353
+ is_object : Check if the Index is of the object dtype. (deprecated).
2354
2354
is_categorical : Check if the Index holds categorical data (deprecated).
2355
2355
is_interval : Check if the Index holds Interval objects (deprecated).
2356
2356
@@ -2395,7 +2395,7 @@ def is_numeric(self) -> bool:
2395
2395
is_boolean : Check if the Index only consists of booleans (deprecated).
2396
2396
is_integer : Check if the Index only consists of integers (deprecated).
2397
2397
is_floating : Check if the Index is a floating type (deprecated).
2398
- is_object : Check if the Index is of the object dtype.
2398
+ is_object : Check if the Index is of the object dtype. (deprecated).
2399
2399
is_categorical : Check if the Index holds categorical data (deprecated).
2400
2400
is_interval : Check if the Index holds Interval objects (deprecated).
2401
2401
@@ -2428,6 +2428,9 @@ def is_object(self) -> bool:
2428
2428
"""
2429
2429
Check if the Index is of the object dtype.
2430
2430
2431
+ .. deprecated:: 2.0.0
2432
+ Use `pandas.api.types.is_object_dtype` instead.
2433
+
2431
2434
Returns
2432
2435
-------
2433
2436
bool
@@ -2461,6 +2464,12 @@ def is_object(self) -> bool:
2461
2464
>>> idx.is_object()
2462
2465
False
2463
2466
"""
2467
+ warnings .warn (
2468
+ f"{ type (self ).__name__ } .is_object is deprecated."
2469
+ "Use pandas.api.types.is_object_dtype instead" ,
2470
+ FutureWarning ,
2471
+ stacklevel = find_stack_level (),
2472
+ )
2464
2473
return is_object_dtype (self .dtype )
2465
2474
2466
2475
@final
@@ -2483,7 +2492,7 @@ def is_categorical(self) -> bool:
2483
2492
is_integer : Check if the Index only consists of integers (deprecated).
2484
2493
is_floating : Check if the Index is a floating type (deprecated).
2485
2494
is_numeric : Check if the Index only consists of numeric data.
2486
- is_object : Check if the Index is of the object dtype.
2495
+ is_object : Check if the Index is of the object dtype. (deprecated).
2487
2496
is_interval : Check if the Index holds Interval objects (deprecated).
2488
2497
2489
2498
Examples
@@ -2536,7 +2545,7 @@ def is_interval(self) -> bool:
2536
2545
is_integer : Check if the Index only consists of integers (deprecated).
2537
2546
is_floating : Check if the Index is a floating type (deprecated).
2538
2547
is_numeric : Check if the Index only consists of numeric data.
2539
- is_object : Check if the Index is of the object dtype.
2548
+ is_object : Check if the Index is of the object dtype. (deprecated).
2540
2549
is_categorical : Check if the Index holds categorical data (deprecated).
2541
2550
2542
2551
Examples
@@ -5018,7 +5027,7 @@ def _is_memory_usage_qualified(self) -> bool:
5018
5027
"""
5019
5028
Return a boolean if we need a qualified .info display.
5020
5029
"""
5021
- return self .is_object ( )
5030
+ return is_object_dtype ( self .dtype )
5022
5031
5023
5032
def __contains__ (self , key : Any ) -> bool :
5024
5033
"""
@@ -5132,7 +5141,7 @@ def _can_hold_identifiers_and_holds_name(self, name) -> bool:
5132
5141
https://github.com/pandas-dev/pandas/issues/19764
5133
5142
"""
5134
5143
if (
5135
- self .is_object ( )
5144
+ is_object_dtype ( self .dtype )
5136
5145
or is_string_dtype (self .dtype )
5137
5146
or is_categorical_dtype (self .dtype )
5138
5147
):
0 commit comments