Skip to content

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

Closed
wants to merge 7 commits into from

Conversation

abast
Copy link
Contributor

@abast abast commented Feb 23, 2017

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"?

Copy link
Contributor

@jreback jreback left a 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

@@ -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):
Copy link
Contributor

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).

Copy link
Contributor

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

Copy link
Contributor Author

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?

@jreback jreback added Compat pandas objects compatability with Numpy or Python functions Msgpack Categorical Categorical Data Type labels Feb 23, 2017
Copy link
Contributor

@jreback jreback left a 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

@@ -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)
Copy link
Contributor

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

@@ -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`)
Copy link
Contributor

Choose a reason for hiding this comment

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

pd.read_msgpack

@jreback jreback added this to the 0.20.0 milestone Feb 24, 2017
@jreback
Copy link
Contributor

jreback commented Feb 24, 2017

thanks!

@jreback jreback closed this in d80275d Feb 24, 2017
AnkurDedania pushed a commit to AnkurDedania/pandas that referenced this pull request Mar 21, 2017
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Categorical Categorical Data Type Compat pandas objects compatability with Numpy or Python functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support CategoricalIndex for read_msgpack
2 participants