Backport PR #36061 on branch 1.1.x (BUG: groupby and agg on read-only array gives ValueError: buffer source array is read-only)
Backport PR #36061: BUG: groupby and agg on read-only array gives ValueError: buffer source array is read-only