Skip to content

Conversation

@jorisvandenbossche
Copy link
Member

@jorisvandenbossche jorisvandenbossche commented Aug 6, 2019

@jorisvandenbossche
Copy link
Member Author

cc @jbrockmendel

if placement is None:
placement = self.mgr_locs
if ndim is None:
ndim = self.ndim
Copy link
Member Author

Choose a reason for hiding this comment

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

Alternative option is to pass self.ndim to the make_block_same_class call in Block.take_nd, but this might be more general for other locations where make_block_same_class is called without specifying ndim. I don't directly can think of a case where you don't want to preserve the ndim unless it was specified.

And eg make_block just above always uses self.ndim

Copy link
Member

Choose a reason for hiding this comment

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

This seems reasonable to me

@jorisvandenbossche jorisvandenbossche added Bug ExtensionArray Extending pandas with custom dtypes or arrays. labels Aug 6, 2019
@jorisvandenbossche jorisvandenbossche added this to the 0.25.1 milestone Aug 6, 2019
@jbrockmendel
Copy link
Member

I tried once to require that ndim be passed and found that some of the downstream tests failed because e.g. pyarrow uses make_block directly

@jorisvandenbossche
Copy link
Member Author

I tried once to require that ndim be passed

That's indeed another option to pass self.ndim to all calls to self.make_block_same_class (there are not too many of them I think), if you prefer.

e.g. pyarrow uses make_block directly

But this is self.make_block_same_class which is probably OK to do?

@jbrockmendel
Copy link
Member

But this is self.make_block_same_class which is probably OK to do?

Yah, looks like pyarrow is only calling the make_block function, not the methods.

@jreback jreback merged commit 38d2372 into pandas-dev:master Aug 7, 2019
@jreback
Copy link
Contributor

jreback commented Aug 7, 2019

thanks @jorisvandenbossche

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug ExtensionArray Extending pandas with custom dtypes or arrays.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: NonConsolidatebleBlock with ndim 1 'take_nd' with len 1 gives wrong ndim

3 participants