pandas-dev/pandas · error · AbstractMethodError
This classmethod must be defined in the concrete class {name
Error message
This classmethod must be defined in the concrete class {name} What it means
Raised (AbstractMethodError, a NotImplementedError subclass) from the base ExtensionArray._from_sequence classmethod when a concrete ExtensionArray subclass has not overridden it. `_from_sequence` is the canonical constructor that turns a 1-D sequence of scalars into an instance; the base implementation only exists to give a clear error. The message uses methodtype='classmethod' so it reads 'This classmethod must be defined in the concrete class <name>'.
Source
Thrown at pandas/core/arrays/base.py:334
Returns
-------
ExtensionArray
See Also
--------
api.extensions.ExtensionArray._from_sequence_of_strings : Construct a new
ExtensionArray from a sequence of strings.
api.extensions.ExtensionArray._hash_pandas_object : Hook for
hash_pandas_object.
Examples
--------
>>> pd.arrays.IntegerArray._from_sequence([4, 5])
<IntegerArray>
[4, 5]
Length: 2, dtype: Int64
"""
raise AbstractMethodError(cls)
@classmethod
def _from_sequence_of_strings(
cls, strings, *, dtype: ExtensionDtype, copy: bool = False
) -> Self:
"""
Construct a new ExtensionArray from a sequence of strings.
This method is used to parse string data into the appropriate
scalar type for the ExtensionArray. It is commonly used when
reading data from text files via parsers like ``read_csv``.
Parameters
----------
strings : Sequence
Each element will be an instance of the scalar type for this
array, ``cls.dtype.type``.
dtype : ExtensionDtypeView on GitHub (pinned to 3b7651241d)
Solutions
- Implement `_from_sequence(cls, scalars, *, dtype=None, copy=False)` in your ExtensionArray subclass and return a new instance.
- If you are just consuming an existing array type and hit this, the type is incompletely implemented — file/fix it upstream rather than working around it.
Example fix
# before
class MyArray(ExtensionArray):
...
# after
class MyArray(ExtensionArray):
@classmethod
def _from_sequence(cls, scalars, *, dtype=None, copy=False):
data = np.array(scalars, dtype=object)
return cls(data) Defensive patterns
Strategy: validation
Validate before calling
from pandas.api.extensions import ExtensionArray
if '_from_sequence' not in vars(type(my_array)):
raise TypeError(f"{type(my_array).__name__} does not implement _from_sequence")
type(my_array)._from_sequence(scalars) Type guard
def implements_from_sequence(arr_cls) -> bool:
return '_from_sequence' in vars(arr_cls) Try / catch
try:
out = MyArray._from_sequence(scalars)
except AbstractMethodError:
raise AbstractMethodError(f"Implement _from_sequence on {MyArray.__name__}") Prevention
- Implement all required ExtensionArray abstract methods when subclassing
- Add a conformance test that calls each mandatory method on a sample instance
When it happens
Trigger: Subclassing ExtensionArray without implementing `_from_sequence`, then calling `MyArray._from_sequence([...])` (directly or via pandas internals like `pandas.array`/casting).
Common situations: Writing a custom extension array and forgetting the mandatory construction classmethods; partial implementations that only override `_from_factorized`.
Related errors
- This method must be defined in the concrete class {name}
- This method must be defined in the concrete class {name}
- {type(self)} does not implement __setitem__.
- cannot diff {type(arr).__name__} on axis={axis}
- {type(arr).__name__} has no 'diff' method. Convert to a suit
AI-assisted analysis of pandas-dev/pandas@3b7651241d (2026-08-11).
Data as JSON: /api/errors/c5f2e0d1df1bb6e7.
Report an issue: GitHub.