Skip to content

BUG: sefault in concat of CategoricalIndex #16133

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

Merged
merged 2 commits into from
Apr 25, 2017

Conversation

chris-b1
Copy link
Contributor

@codecov
Copy link

codecov bot commented Apr 25, 2017

Codecov Report

Merging #16133 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16133      +/-   ##
==========================================
- Coverage   90.86%   90.86%   -0.01%     
==========================================
  Files         159      159              
  Lines       50771    50773       +2     
==========================================
+ Hits        46133    46134       +1     
- Misses       4638     4639       +1
Flag Coverage Δ
#multiple 88.64% <100%> (-0.01%) ⬇️
#single 40.33% <25%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/indexes/category.py 98.44% <100%> (ø) ⬆️
pandas/core/common.py 90.68% <0%> (-0.35%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d122e6...5b6be78. Read the comment docs.

@codecov
Copy link

codecov bot commented Apr 25, 2017

Codecov Report

Merging #16133 into master will decrease coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16133      +/-   ##
==========================================
- Coverage   90.86%   90.83%   -0.03%     
==========================================
  Files         159      159              
  Lines       50771    50773       +2     
==========================================
- Hits        46133    46122      -11     
- Misses       4638     4651      +13
Flag Coverage Δ
#multiple 88.61% <100%> (-0.03%) ⬇️
#single 40.33% <25%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/indexes/category.py 98.44% <100%> (ø) ⬆️
pandas/plotting/_converter.py 63.54% <0%> (-1.82%) ⬇️
pandas/core/common.py 90.68% <0%> (-0.35%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d122e6...5b6be78. Read the comment docs.

@chris-b1 chris-b1 changed the title BUG: sefault in concat of cat-idx BUG: sefault in concat of CategoricalIndex Apr 25, 2017
@TomAugspurger
Copy link
Contributor

TomAugspurger commented Apr 25, 2017

@chris-b1 your test example doesn't segfault for me on master, but the fix does work. Do the share the same underlying issue?

@chris-b1
Copy link
Contributor Author

Yeah, the underlying problem is the we end up with a bad indexer, which is passed to take_nd, which doesn't bounds check, and end up with either a bad result (like the test) or a segfault. Here is one that segfaults on master.

categories = list('vabcdefghijklmnopqrstu')

a = pd.Series(1, index=pd.CategoricalIndex(categories[:5], categories=categories))
b = pd.Series(2, index=pd.CategoricalIndex(categories[3:10], categories=categories))
c = pd.Series(3, index=pd.CategoricalIndex(categories[8:15], categories=categories))

result = pd.concat([a, b, c], axis=1)

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.

lgtm merge away

@chris-b1 chris-b1 added this to the 0.20.0 milestone Apr 25, 2017
@chris-b1 chris-b1 added Bug Categorical Categorical Data Type Indexing Related to indexing on series/frames, not to indexes themselves labels Apr 25, 2017
@chris-b1 chris-b1 merged commit 186957e into pandas-dev:master Apr 25, 2017
pcluo pushed a commit to pcluo/pandas that referenced this pull request May 22, 2017
* BUG: sefault in concat of cat-idx

* lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Categorical Categorical Data Type Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.concat crashes Python
3 participants