-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
msgpack supports CategoricalIndex #15493
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
Conversation
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.
you edit pandas/doc/source/whatsnew/v0.20.0.txt
for this Bug Fix
pandas/tests/msgpack/test_unpack.py
Outdated
@@ -62,3 +63,14 @@ def _hook(self, code, data): | |||
assert unpacker.unpack() == {'a': 123} | |||
unpacker.feed(packb({'a': ExtType(2, b'321')}, encoding='utf-8')) | |||
assert unpacker.unpack() == {'a': ExtType(2, b'321')} | |||
|
|||
def test_unpack_categorical_index(self): |
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.
the tests are all in pandas/tests/io/test_packers.py
(this section is for the c-code that implements msgpack itself).
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.
just follow examples there for style
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.
Thanks, I tried to change the it accordingly. Do you get a notification if I push new commits? Or should I comment?
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.
small comments ping when all green
pandas/tests/io/test_packers.py
Outdated
@@ -123,6 +123,11 @@ def test_string_io(self): | |||
result = read_msgpack(s) | |||
tm.assert_frame_equal(result, df) | |||
|
|||
df2 = df.astype({0: 'category'}).set_index(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.
make a new test function
add the issue number as a comment
doc/source/whatsnew/v0.20.0.txt
Outdated
@@ -627,3 +627,4 @@ Bug Fixes | |||
- Bug in ``Series.replace`` and ``DataFrame.replace`` which failed on empty replacement dicts (:issue:`15289`) | |||
- Bug in ``pd.melt()`` where passing a tuple value for ``value_vars`` caused a ``TypeError`` (:issue:`15348`) | |||
- Bug in ``.eval()`` which caused multiline evals to fail with local variables not on the first line (:issue:`15342`) | |||
- Bug in ``DataFrame.read_msgpack`` which did not allow to load DataFrames with a CategoricalIndex (:issue:`15487`) |
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.
pd.read_msgpack
thanks! |
closes pandas-dev#15487 Author: Arco Bast <[email protected]> Closes pandas-dev#15493 from abast/CategoricalIndex_msgpack and squashes the following commits: c1c68e4 [Arco Bast] corrections 3c1f2e7 [Arco Bast] whatsnew 215c2aa [Arco Bast] improve tests cd9354f [Arco Bast] improve tests 7895c16 [Arco Bast] flake8 f3f492a [Arco Bast] fix test 91d85cb [Arco Bast] msgpack supports CategoricalIndex
git diff upstream/master | flake8 --diff
This allows
read_msgpack
to read DataFrames with a categorical index. I'd assume that my testcase needs some improvement. Where can I find some information where and how to add the "whatsnew entry"?