{"record":{"id":"93233f43a5f5dec8","repo":"pandas-dev/pandas","slug":"converting-strings-to-pa-type-is-not-implemented","errorCode":null,"errorMessage":"Converting strings to {pa_type} is not implemented.","messagePattern":"Converting strings to (.+?) is not implemented\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"pandas/core/arrays/arrow/array.py","lineNumber":521,"sourceCode":"            scalars = pc.if_else(pc.equal(scalars, \"0.0\"), \"0\", scalars)\n            scalars = scalars.cast(pa.bool_())\n        elif (\n            pa.types.is_integer(pa_type)\n            or pa.types.is_floating(pa_type)\n            or pa.types.is_decimal(pa_type)\n        ):\n            from pandas.core.tools.numeric import to_numeric\n\n            scalars = to_numeric(strings, errors=\"raise\")\n            if is_pa_array:\n                scalars = strings.cast(pa_type)\n            else:\n                mask = isna(strings)\n                if mask is not None:\n                    scalars = pa.array(scalars, mask=mask, type=pa_type)\n\n        else:\n            raise NotImplementedError(\n                f\"Converting strings to {pa_type} is not implemented.\"\n            )\n        return cls._from_sequence(scalars, dtype=pa_type, copy=copy)\n\n    def _from_pyarrow_array(self, pa_array):\n        \"\"\"\n        Construct from a pyarrow Array/ChunkedArray result of an operation.\n\n        Avoids full __init__ overhead by reusing the dtype when the pyarrow\n        type is unchanged.\n        \"\"\"\n        assert isinstance(pa_array, (pa.Array, pa.ChunkedArray))\n        obj = type(self).__new__(type(self))\n        if isinstance(pa_array, pa.Array):\n            pa_array = pa.chunked_array([pa_array])\n        obj._pa_array = pa_array\n        pa_type = pa_array.type\n        obj._dtype = (","sourceCodeStart":503,"sourceCodeEnd":539,"githubUrl":"https://github.com/pandas-dev/pandas/blob/3b7651241d4da534b3559b60ef128e1c34f54116/pandas/core/arrays/arrow/array.py#L503-L539","documentation":"Raised by ArrowExtensionArray._from_sequence_of_strings when the target pyarrow dtype is not one of the types pandas knows how to parse from strings (string/binary, timestamp, date, duration, time, boolean, integer, float, decimal). It is the terminal else-branch of the string-parsing dispatch. If you need a pyarrow type outside that allow-list (e.g. list_, struct, fixed_size_binary, large_binary, month_day_nano_interval), pandas cannot currently build it from raw strings.","triggerScenarios":"Calling pd.array(['1','2'], dtype='<unsupported-pa-type>[pyarrow]') where the pyarrow type is a list/struct/interval/fixed_size_binary/etc; or _from_sequence_of_strings invoked internally by read_csv/astype when the column dtype resolves to an exotic pyarrow type; or constructing an ArrowDtype from pa.list_(pa.int64()) and then asking pandas to populate it from string values.","commonSituations":"Loading a CSV column and casting to a nested pyarrow type (list_, struct_, fixed_size_binary, large_binary, interval); users hand-constructing ArrowDtype(pa.large_binary()) and feeding strings; pyarrow schema-driven ingestion where the schema contains a type pandas' string parser does not cover.","solutions":["Parse the strings into Python objects matching the target type first, then construct via _from_sequence (not _from_sequence_of_strings).","For nested types, build the pa.Array yourself with pyarrow and pass it through ArrowExtensionArray(pa_array).","Switch the target dtype to a supported primitive (string, int, float, bool, timestamp, date, duration, time, decimal) when ingesting from strings.","For list_/struct types, parse with pandas first into a Series of Python lists/dicts, then convert with .astype('...[pyarrow]')."],"exampleFix":"# before\nimport pyarrow as pa\nimport pandas as pd\npd.array(['1', '2'], dtype=pd.ArrowDtype(pa.list_(pa.int64())))\n# raises NotImplementedError: Converting strings to list<item: int64> is not implemented.\n\n# after\npd.array([[1, 2], [3, 4]], dtype=pd.ArrowDtype(pa.list_(pa.int64())))","handlingStrategy":"validation","validationCode":"import pyarrow as pa\nimport pandas as pd\n\nSUPPORTED_FROM_STRINGS = (\n    pa.types.is_string, pa.types.is_large_string, pa.types.is_binary,\n    pa.types.is_timestamp, pa.types.is_date, pa.types.is_duration,\n    pa.types.is_time, pa.types.is_boolean, pa.types.is_integer,\n    pa.types.is_floating, pa.types.is_decimal,\n)\n\ndef can_parse_from_strings(pa_type) -> bool:\n    return any(check(pa_type) for check in SUPPORTED_FROM_STRINGS)","typeGuard":null,"tryCatchPattern":"try:\n    arr = pd.array(strings, dtype=pd.ArrowDtype(pa_type))\nexcept NotImplementedError as e:\n    if 'Converting strings to' in str(e):\n        # parse to python objects first, then construct\n        arr = pd.array(parsed_objects, dtype=pd.ArrowDtype(pa_type))\n    else:\n        raise","preventionTips":["Pre-parse strings into Python objects matching the target type when using nested pyarrow dtypes.","Maintain an allow-list of pyarrow types supported by _from_sequence_of_strings.","Build pa.Array directly with pyarrow for unsupported types."],"tags":["pyarrow","dtype","parsing","from-sequence","notimplemented"],"backgroundTag":null,"analyzedSha":"3b7651241d4da534b3559b60ef128e1c34f54116","analyzedAt":"2026-08-11T22:10:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}