{"record":{"id":"b8b165acc155827d","repo":"pandas-dev/pandas","slug":"this-method-must-be-defined-in-the-concrete-class-b8b165","errorCode":null,"errorMessage":"This method must be defined in the concrete class {name}","messagePattern":"This method must be defined in the concrete class (.+?)","errorType":"exception","errorClass":"AbstractMethodError","httpStatus":null,"severity":"error","filePath":"pandas/core/arrays/base.py","lineNumber":378,"sourceCode":"        ExtensionArray\n\n        See Also\n        --------\n        api.extensions.ExtensionArray._from_sequence : Construct a new ExtensionArray\n            from a sequence of scalars.\n        api.extensions.ExtensionArray._from_factorized : Reconstruct an ExtensionArray\n            after factorization.\n\n        Examples\n        --------\n        >>> pd.arrays.IntegerArray._from_sequence_of_strings(\n        ...     [\"1\", \"2\", \"3\"], dtype=pd.Int64Dtype()\n        ... )\n        <IntegerArray>\n        [1, 2, 3]\n        Length: 3, dtype: Int64\n        \"\"\"\n        raise AbstractMethodError(cls)\n\n    @classmethod\n    def _from_factorized(cls, values, original):\n        \"\"\"\n        Reconstruct an ExtensionArray after factorization.\n\n        This method reverses the encoding applied by :meth:`factorize`,\n        recreating an ExtensionArray from the unique values and original\n        array metadata.\n\n        Parameters\n        ----------\n        values : ndarray\n            An integer ndarray with the factorized values.\n        original : ExtensionArray\n            The original ExtensionArray that factorize was called on.\n\n        See Also","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/pandas-dev/pandas/blob/3b7651241d4da534b3559b60ef128e1c34f54116/pandas/core/arrays/base.py#L360-L396","documentation":"Raised (AbstractMethodError) from the base ExtensionArray._from_sequence_of_strings classmethod when a subclass has not overridden it. This method parses string input (e.g. from read_csv) into the extension array's scalar type; the base stub exists solely to surface a precise error instead of a generic NotImplementedError. Unlike _from_sequence it is not strictly abstract for all types, but anything that can be read from text must define it.","triggerScenarios":"Calling `MyArray._from_sequence_of_strings([...], dtype=...)` on a custom ExtensionArray that did not override it; routing string data into a custom dtype via read_csv/pandas.array.","commonSituations":"Custom extension dtype intended to be parseable from CSV but missing the string-parsing constructor; tests that exercise the read_csv path for a new dtype.","solutions":["Implement `_from_sequence_of_strings(cls, strings, *, dtype, copy=False)` in your subclass, parsing each string into the scalar type.","If your dtype is never constructed from strings, leave it unimplemented and avoid routing string input into it."],"exampleFix":"# before\nclass MyArray(ExtensionArray):\n    ...\n# after\nclass MyArray(ExtensionArray):\n    @classmethod\n    def _from_sequence_of_strings(cls, strings, *, dtype, copy=False):\n        scalars = [_parse(s) for s in strings]\n        return cls._from_sequence(scalars, dtype=dtype, copy=copy)","handlingStrategy":"validation","validationCode":"if '_from_sequence_of_strings' not in vars(type(my_array)):\n    raise TypeError(f\"{type(my_array).__name__} cannot parse from strings\")\ntype(my_array)._from_sequence_of_strings(strings, dtype=dtype)","typeGuard":"def implements_from_strings(arr_cls) -> bool:\n    return '_from_sequence_of_strings' in vars(arr_cls)","tryCatchPattern":"try:\n    out = MyArray._from_sequence_of_strings(strings, dtype=dtype)\nexcept AbstractMethodError:\n    raise AbstractMethodError(f\"Implement _from_sequence_of_strings on {MyArray.__name__} to parse from text\")","preventionTips":["Implement _from_sequence_of_strings if your dtype is read from CSV","Gate string parsing tests behind this method's presence"],"tags":["extension-array","abstract-method","subclassing","parsing"],"backgroundTag":null,"analyzedSha":"3b7651241d4da534b3559b60ef128e1c34f54116","analyzedAt":"2026-08-11T22:10:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}