pandas-dev/pandas · error · NotImplementedError

{type(self)} does not support reshape as backed by a 1D pyar

Error message

{type(self)} does not support reshape as backed by a 1D pyarrow.ChunkedArray.

What it means

ArrowExtensionArray.reshape unconditionally raises NotImplementedError. The backing storage is a 1D pyarrow.ChunkedArray, which has no native concept of multi-dimensional shape, so reshape semantics cannot be honored.

Source

Thrown at pandas/core/arrays/arrow/array.py:1896

            indices = np.array([], dtype=np.intp)
            uniques = self._from_pyarrow_array(
                pa.chunked_array([], type=encoded.type.value_type)
            )
        else:
            # GH 54844
            combined = encoded.combine_chunks()
            pa_indices = combined.indices
            if pa_indices.null_count > 0:
                pa_indices = _safe_fill_null(pa_indices, -1)
            indices = pa_indices.to_numpy(zero_copy_only=False, writable=True).astype(
                np.intp, copy=False
            )
            uniques = self._from_pyarrow_array(combined.dictionary)

        return indices, uniques

    def reshape(self, *args, **kwargs):
        raise NotImplementedError(
            f"{type(self)} does not support reshape "
            f"as backed by a 1D pyarrow.ChunkedArray."
        )

    def round(self, decimals: int = 0, *args, **kwargs) -> Self:
        """
        Round each value in the array a to the given number of decimals.

        Parameters
        ----------
        decimals : int, default 0
            Number of decimal places to round to. If decimals is negative,
            it specifies the number of positions to the left of the decimal point.
        *args, **kwargs
            Additional arguments and keywords have no effect.

        Returns
        -------

View on GitHub (pinned to 71959b8cb9)

Solutions

  1. Materialize to a numpy array first: `arr.to_numpy().reshape(...)` (note: this may copy and lose pyarrow-specific types like decimal).
  2. If you need a 2D DataFrame view, construct it explicitly with the desired columns instead of reshaping.
  3. Switch the dtype away from `[pyarrow]` if reshape is a core requirement.

Example fix

// before
arr = pd.array([1, 2, 3, 4], dtype="int64[pyarrow]")
arr.reshape(2, 2)

// after
arr.to_numpy().reshape(2, 2)
Defensive patterns

Strategy: validation

Validate before calling

def safe_reshape(arr, *shape):
    # ArrowExtensionArray cannot reshape; materialize to numpy first
    return arr.to_numpy().reshape(*shape)

Type guard

def supports_reshape(arr) -> bool:
    # pyarrow-backed ExtensionArrays never support reshape
    import pandas as pd
    return not isinstance(getattr(arr, "dtype", None), pd.ArrowDtype)

Try / catch

try:
    arr.reshape(2, 2)
except NotImplementedError as e:
    if "does not support reshape" in str(e):
        out = arr.to_numpy().reshape(2, 2)
    else:
        raise

Prevention

When it happens

Trigger: Calling `.reshape(...)` directly on an ArrowExtensionArray instance, or via numpy/pandas code paths that dispatch reshape to the ExtensionArray.

Common situations: Porting numpy ndarray code to pyarrow dtypes, calling `arr.values.reshape(...)` on a Series, or libraries that expect ndarray-like reshape on arbitrary array objects.

Related errors


AI-assisted analysis of pandas-dev/pandas@71959b8cb9 (2026-08-07). Data as JSON: /api/errors/9a55bba848377260. Report an issue: GitHub.