-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
DEPR: msgpack #30112
Merged
Merged
DEPR: msgpack #30112
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
9e7b320
DEPR: msgpack
jbrockmendel ae660e6
Merge branch 'master' of https://github.com/pandas-dev/pandas into de…
jbrockmendel facab5a
upate optional deps
jbrockmendel 64d817b
fixup isort, rebase mistakes
jbrockmendel 522723e
Merge branch 'master' of https://github.com/pandas-dev/pandas into de…
jbrockmendel 643cc5f
troubleshoot docs
jbrockmendel cc67a16
Merge branch 'master' of https://github.com/pandas-dev/pandas into de…
jbrockmendel 12b831c
troubleshoot docs
jbrockmendel eda359e
Merge branch 'master' of https://github.com/pandas-dev/pandas into de…
jbrockmendel b4e1656
removee no-longer-valid ref
jbrockmendel 5654671
restore docs
jbrockmendel 2f661b1
Merge branch 'master' of https://github.com/pandas-dev/pandas into de…
jbrockmendel 01086d2
remove licensue, put stub entry in io.rst
jbrockmendel 6bd5f4c
Merge branch 'master' of https://github.com/pandas-dev/pandas into de…
jbrockmendel 08a5d7b
port pyarrow example
jbrockmendel 460540c
Merge branch 'master' of https://github.com/pandas-dev/pandas into de…
jbrockmendel 7d32540
troubleshoot
jbrockmendel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,6 @@ Flat file | |
read_table | ||
read_csv | ||
read_fwf | ||
read_msgpack | ||
|
||
Clipboard | ||
~~~~~~~~~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3382,87 +3382,19 @@ The default is to 'infer': | |
msgpack | ||
------- | ||
|
||
pandas supports the ``msgpack`` format for | ||
object serialization. This is a lightweight portable binary format, similar | ||
to binary JSON, that is highly space efficient, and provides good performance | ||
both on the writing (serialization), and reading (deserialization). | ||
pandas support for ``msgpack`` has been removed in version 1.0.0. It is recommended to use pyarrow for on-the-wire transmission of pandas objects. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we currently have a small code snippet in the doc-string of how to use pyarrow, can you copy it here as a code-block |
||
|
||
.. warning:: | ||
|
||
The msgpack format is deprecated as of 0.25 and will be removed in a future version. | ||
It is recommended to use pyarrow for on-the-wire transmission of pandas objects. | ||
|
||
.. warning:: | ||
|
||
:func:`read_msgpack` is only guaranteed backwards compatible back to pandas version 0.20.3 | ||
|
||
.. ipython:: python | ||
:okwarning: | ||
|
||
df = pd.DataFrame(np.random.rand(5, 2), columns=list('AB')) | ||
df.to_msgpack('foo.msg') | ||
pd.read_msgpack('foo.msg') | ||
s = pd.Series(np.random.rand(5), index=pd.date_range('20130101', periods=5)) | ||
|
||
You can pass a list of objects and you will receive them back on deserialization. | ||
|
||
.. ipython:: python | ||
:okwarning: | ||
|
||
pd.to_msgpack('foo.msg', df, 'foo', np.array([1, 2, 3]), s) | ||
pd.read_msgpack('foo.msg') | ||
|
||
You can pass ``iterator=True`` to iterate over the unpacked results: | ||
|
||
.. ipython:: python | ||
:okwarning: | ||
|
||
for o in pd.read_msgpack('foo.msg', iterator=True): | ||
print(o) | ||
|
||
You can pass ``append=True`` to the writer to append to an existing pack: | ||
|
||
.. ipython:: python | ||
:okwarning: | ||
Example pyarrow usage: | ||
|
||
df.to_msgpack('foo.msg', append=True) | ||
pd.read_msgpack('foo.msg') | ||
|
||
Unlike other io methods, ``to_msgpack`` is available on both a per-object basis, | ||
``df.to_msgpack()`` and using the top-level ``pd.to_msgpack(...)`` where you | ||
can pack arbitrary collections of Python lists, dicts, scalars, while intermixing | ||
pandas objects. | ||
|
||
.. ipython:: python | ||
:okwarning: | ||
|
||
pd.to_msgpack('foo2.msg', {'dict': [{'df': df}, {'string': 'foo'}, | ||
{'scalar': 1.}, {'s': s}]}) | ||
pd.read_msgpack('foo2.msg') | ||
|
||
.. ipython:: python | ||
:suppress: | ||
:okexcept: | ||
|
||
os.remove('foo.msg') | ||
os.remove('foo2.msg') | ||
|
||
Read/write API | ||
'''''''''''''' | ||
|
||
Msgpacks can also be read from and written to strings. | ||
|
||
.. ipython:: python | ||
:okwarning: | ||
|
||
df.to_msgpack() | ||
|
||
Furthermore you can concatenate the strings to produce a list of the original objects. | ||
.. code-block:: python | ||
|
||
.. ipython:: python | ||
:okwarning: | ||
>>> import pandas as pd | ||
>>> import pyarrow as pa | ||
>>> df = pd.DataFrame({'A': [1, 2, 3]}) | ||
>>> context = pa.default_serialization_context() | ||
>>> df_bytestring = context.serialize(df).to_buffer().to_pybytes() | ||
|
||
pd.read_msgpack(df.to_msgpack() + s.to_msgpack()) | ||
For documentation on pyarrow, see `here <https://arrow.apache.org/docs/python/index.html>`__. | ||
|
||
.. _io.hdf5: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this is deprecated/removed on a very short time frame, I think it might be good to keep this title a bit longer with a small note that it was deprecated/removed and how to replace it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? the whole point is to clean things for 1.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To provide documentation about this removal, and how to replace it.
For example, there have been issues opened with questions about this which lead to added examples in the docstrings, but this has never been published yet in actual documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k that’s fair
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restored this section. LMK if you have suggestions for additional notes to put in here.
any thoughts on the LICENSE files mentioned in the OP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't restore the full section, but rather only keep a short explanation that it was deprecated/removed, and how to replace it (see the docstrings for some content for that)