pandas-dev/pandas · error · NotImplementedError
Converting strings to
Error message
Converting strings to {pa_type} is not implemented. What it means
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.
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]').
Example fix
# before import pyarrow as pa import pandas as pd pd.array(['1', '2'], dtype=pd.ArrowDtype(pa.list_(pa.int64()))) # raises NotImplementedError: Converting strings to list<item: int64> is not implemented. # after pd.array([[1, 2], [3, 4]], dtype=pd.ArrowDtype(pa.list_(pa.int64())))
Defensive patterns
Strategy: validation
Validate before calling
import pyarrow as pa
import pandas as pd
SUPPORTED_FROM_STRINGS = (
pa.types.is_string, pa.types.is_large_string, pa.types.is_binary,
pa.types.is_timestamp, pa.types.is_date, pa.types.is_duration,
pa.types.is_time, pa.types.is_boolean, pa.types.is_integer,
pa.types.is_floating, pa.types.is_decimal,
)
def can_parse_from_strings(pa_type) -> bool:
return any(check(pa_type) for check in SUPPORTED_FROM_STRINGS) Try / catch
try:
arr = pd.array(strings, dtype=pd.ArrowDtype(pa_type))
except NotImplementedError as e:
if 'Converting strings to' in str(e):
# parse to python objects first, then construct
arr = pd.array(parsed_objects, dtype=pd.ArrowDtype(pa_type))
else:
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- ArrowStringArray requires a PyArrow (chunked) array of…
- Expected array of boolean type, got
- interpolate is not implemented for dtype=
- Invalid value ' ' for dtype
- {pa_type}
AI-assisted analysis of pandas-dev/pandas@3b7651241d (2026-08-11).
Data as JSON: /api/errors/93233f43a5f5dec8.
Report an issue: GitHub.
Appendix: source
Thrown at pandas/core/arrays/arrow/array.py:521
scalars = pc.if_else(pc.equal(scalars, "0.0"), "0", scalars)
scalars = scalars.cast(pa.bool_())
elif (
pa.types.is_integer(pa_type)
or pa.types.is_floating(pa_type)
or pa.types.is_decimal(pa_type)
):
from pandas.core.tools.numeric import to_numeric
scalars = to_numeric(strings, errors="raise")
if is_pa_array:
scalars = strings.cast(pa_type)
else:
mask = isna(strings)
if mask is not None:
scalars = pa.array(scalars, mask=mask, type=pa_type)
else:
raise NotImplementedError(
f"Converting strings to {pa_type} is not implemented."
)
return cls._from_sequence(scalars, dtype=pa_type, copy=copy)
def _from_pyarrow_array(self, pa_array):
"""
Construct from a pyarrow Array/ChunkedArray result of an operation.
Avoids full __init__ overhead by reusing the dtype when the pyarrow
type is unchanged.
"""
assert isinstance(pa_array, (pa.Array, pa.ChunkedArray))
obj = type(self).__new__(type(self))
if isinstance(pa_array, pa.Array):
pa_array = pa.chunked_array([pa_array])
obj._pa_array = pa_array
pa_type = pa_array.type
obj._dtype = (View on GitHub (pinned to 3b7651241d)