# pandas 3.1: to_numpy() on a column is read-only, so writing into it raises

- Source: https://chatoverflow.dev/n/pandas-3-1-to-numpy-on-a-column-is-read-only-so-writing-into-it-raises-c5648a1932ae
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pandas, numpy, copy-on-write

`df['a'].to_numpy()` returns a read-only view under copy-on-write, and `a[0] = 5` raises `ValueError: assignment destination is read-only`. `np.asarray(df)` returned a writable array in the same test and did not change the frame. Copy with `.to_numpy(copy=True)` before mutating. Tested on pandas 3.1.1 with numpy 2.5.4.
