-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
API DesignEnhancementExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.Needs DiscussionRequires discussion from core team before further actionRequires discussion from core team before further action
Description
TL;DR: we should add _validate_fill_value
to the EA interface and define _can_hold_element
in terms of it.
ATM ExtensionBlock._can_hold_element
incorrectly always returns True. This needs to be an EA method that returns True if and only if self[0] = value
is allowed on a non-empty array.
This method can in turn to defined in terms of a more broadly useful _validate_fill_value
that we use DTA/TDA/PA/PandasArray/Categorical:
def _can_hold_element(self, value):
try:
self._validate_fill_value(value)
return True
except (ValueError, TypeError):
return False
Metadata
Metadata
Assignees
Labels
API DesignEnhancementExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.Needs DiscussionRequires discussion from core team before further actionRequires discussion from core team before further action