Skip to content

[inequality] Take writeable copy before rd.shuffle (pandas 3.0 read-only fix)#776

Merged
mmcky merged 1 commit into
mainfrom
fix-inequality-pandas3-readonly
Jun 26, 2026
Merged

[inequality] Take writeable copy before rd.shuffle (pandas 3.0 read-only fix)#776
mmcky merged 1 commit into
mainfrom
fix-inequality-pandas3-readonly

Conversation

@mmcky

@mmcky mmcky commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Under the anaconda=2026.06 stack (pandas 3.0), np.asarray() of a Series returns a read-only array (Copy-on-Write), so the in-place rd.shuffle(y) in the Lorenz-curve loop raised ValueError: assignment destination is read-only and aborted execution of inequality.md. This takes a writeable .copy() before the shuffle.

This clears one of the two anaconda=2026.06 build failures tracked in #775. The other two notebooks (input_output, networks) are blocked by an upstream quantecon_book_networks issue (QuantEcon/quantecon-book-networks#21), so the cache build won't be fully green until that lands (or setuptools is added as a stopgap).

Found during the cross-repo anaconda 2026.06 validation sweep.

🤖 Generated with Claude Code

pandas 3.0 returns a read-only array from np.asarray() of a Series (Copy-on-Write), so rd.shuffle(y) raised "ValueError: assignment destination is read-only" during the anaconda=2026.06 build. Take a writeable .copy() before the in-place shuffle. See #775.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 26, 2026 07:28
@netlify

netlify Bot commented Jun 26, 2026

Copy link
Copy Markdown

Deploy Preview for taupe-gaufre-c4e660 ready!

Name Link
🔨 Latest commit 7c6d892
🔍 Latest deploy log https://app.netlify.com/projects/taupe-gaufre-c4e660/deploys/6a3e2a2f3a355600082180a5
😎 Deploy Preview https://deploy-preview-776--taupe-gaufre-c4e660.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

1 similar comment
@netlify

netlify Bot commented Jun 26, 2026

Copy link
Copy Markdown

Deploy Preview for taupe-gaufre-c4e660 ready!

Name Link
🔨 Latest commit 7c6d892
🔍 Latest deploy log https://app.netlify.com/projects/taupe-gaufre-c4e660/deploys/6a3e2a2f3a355600082180a5
😎 Deploy Preview https://deploy-preview-776--taupe-gaufre-c4e660.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes execution of the inequality lecture under the anaconda=2026.06 stack (pandas 3.0 Copy-on-Write), where np.asarray() on a Series can yield a read-only NumPy array and cause random.shuffle to raise ValueError: assignment destination is read-only.

Changes:

  • Make the array backing the Lorenz-curve shuffle explicitly writeable by taking a .copy() after np.asarray(...).
  • Add an inline note explaining the pandas 3.0 read-only behavior and why the copy is needed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

@github-actions github-actions Bot temporarily deployed to pull request June 26, 2026 07:38 Inactive
@github-actions github-actions Bot temporarily deployed to pull request June 26, 2026 07:38 Inactive
@mmcky mmcky merged commit 1ed02f0 into main Jun 26, 2026
8 checks passed
@mmcky mmcky deleted the fix-inequality-pandas3-readonly branch June 26, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants