Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for Pandas DataFrame Serialization #3841

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lalagi
Copy link

@lalagi lalagi commented Mar 14, 2025

Description:
This pull request introduces support for serializing a pandas DataFrame objects within the JsonPlus serializer. The changes include:

  • Extending the msgpack default serialization function to check if an object is a pandas DataFrame. If so, the DataFrame is converted to a dictionary using its to_dict() method, then wrapped in a msgpack ExtType with a unique extension code.

  • Leveraging the existing deserialization logic (EXT_CONSTRUCTOR_POS_ARGS) to reconstruct the DataFrame from the serialized dictionary.

  • Enabling modules like MemorySaver to store DataFrame objects directly using the new serialization support, allowing for seamless saving and retrieval of DataFrames without additional modifications.

Copy link

vercel bot commented Mar 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langgraph-docs-preview ⬜️ Ignored (Inspect) Visit Preview Mar 19, 2025 8:47pm

@@ -5,6 +5,7 @@
import pathlib
import re
from collections import deque
from pandas import DataFrame
Copy link
Contributor

Choose a reason for hiding this comment

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

we can't add a dependency on pandas sadly

@eyurtsev
Copy link
Collaborator

eyurtsev commented Mar 19, 2025

Prior to merging:

  • Make dependency on pandas optional
  • Requires adding unit tests

@eyurtsev eyurtsev self-assigned this Mar 19, 2025
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.

3 participants