Skip to content

Conversation

@AkiTheMemeGod
Copy link

This pull request introduces a new versioning feature for DataFrame objects, allowing users to create, restore, list, drop, and clear named snapshots of a DataFrame's state. This is implemented via a per-instance snapshot store, and is thoroughly tested to ensure correct behavior. The changes add new methods to DataFrame, a supporting module, and a dedicated test suite.

New DataFrame snapshot/versioning API:

  • Added new methods to DataFrame: snapshot, restore, list_snapshots, drop_snapshot, clear_snapshots, and snapshot_info, enabling users to save and restore DataFrame states by name or timestamp.
  • Implemented helper function _ensure_snapshot_store to manage per-instance snapshot storage.

Supporting infrastructure:

  • Introduced new module pandas/core/frame_versioning.py with the DataFrameSnapshotStore class, handling deep copies of DataFrames for snapshot storage and retrieval, and managing snapshot metadata.
  • Updated imports in pandas/core/frame.py to include Optional and the new snapshot store module. [1] [2]

Testing:

  • Added comprehensive tests in pandas/tests/frame/test_versioning.py covering all new snapshot-related behaviors, including edge cases and error handling.
@mroeschke
Copy link
Member

Thanks for the PR, but it doesn't appear that this is feature is associated with an open issue and appears to be largely covered by pickling, so closing

@mroeschke mroeschke closed this Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants