@@ -38,10 +38,9 @@ class ExtensionArray(object):
38
38
* copy
39
39
* _concat_same_type
40
40
41
- Some additional methods are available to satisfy pandas' internal, private
42
- block API:
41
+ An additional method is available to satisfy pandas' internal,
42
+ private block API.
43
43
44
- * _can_hold_na
45
44
* _formatting_values
46
45
47
46
Some methods require casting the ExtensionArray to an ndarray of Python
@@ -399,7 +398,8 @@ def _values_for_factorize(self):
399
398
Returns
400
399
-------
401
400
values : ndarray
402
- An array suitable for factoraization. This should maintain order
401
+
402
+ An array suitable for factorization. This should maintain order
403
403
and be a supported dtype (Float64, Int64, UInt64, String, Object).
404
404
By default, the extension array is cast to object dtype.
405
405
na_value : object
@@ -422,7 +422,7 @@ def factorize(self, na_sentinel=-1):
422
422
Returns
423
423
-------
424
424
labels : ndarray
425
- An interger NumPy array that's an indexer into the original
425
+ An integer NumPy array that's an indexer into the original
426
426
ExtensionArray.
427
427
uniques : ExtensionArray
428
428
An ExtensionArray containing the unique values of `self`.
@@ -566,16 +566,12 @@ def _concat_same_type(cls, to_concat):
566
566
"""
567
567
raise AbstractMethodError (cls )
568
568
569
- @property
570
- def _can_hold_na (self ):
571
- # type: () -> bool
572
- """Whether your array can hold missing values. True by default.
573
-
574
- Notes
575
- -----
576
- Setting this to false will optimize some operations like fillna.
577
- """
578
- return True
569
+ # The _can_hold_na attribute is set to True so that pandas internals
570
+ # will use the ExtensionDtype.na_value as the NA value in operations
571
+ # such as take(), reindex(), shift(), etc. In addition, those results
572
+ # will then be of the ExtensionArray subclass rather than an array
573
+ # of objects
574
+ _can_hold_na = True
579
575
580
576
@property
581
577
def _ndarray_values (self ):
0 commit comments