Skip to content

FIX numpy with an array of lists - #562

Open
adrinjalali wants to merge 1 commit into
mainfrom
gh561-object-array-shape
Open

adrinjalali wants to merge 1 commit into
mainfrom
gh561-object-array-shape

Conversation

@adrinjalali

Copy link
Copy Markdown
Member

Fixes #561 (cc @landfvit)

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.

🟢 Approval recommended

No active review issues are reported for the fix preserving object-array shapes and cell types during deserialization.

No open issues 🎉

What changed in this PR

Fixes #561 by preserving the shape and cell types of NumPy object arrays containing equal-length sequences during deserialization.

Changes:

  • Allocates object arrays using their recorded shape and assigns cells individually to prevent extra dimensions.
  • Adds round-trip tests for list, tuple, and ndarray cells across one-, two-, and three-dimensional arrays.
  • Documents the fix in the v0.17 changelog.
File Description
skops/​io/​tests/​test_persist.py Adds regression tests checking array shape, dtype, cell types, and values.
skops/​io/​_numpy.py Reconstructs object arrays cell by cell using the saved shape.
docs/​changes.rst Records the sequence-valued object-array loading fix.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

Nonempty object arrays with sequence-valued cells change shape on round trip

2 participants