-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Internals: concat does not preserve block types / does not take ndim of blocks into account #17283
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
Comments
@jreback Do you have an opinion about this? |
Thought I'd ping this in case this got lost in @jreback's inbox (which I'm sure is overflowing). This poses a significant usability issue to the geopandas cythonization process. |
Oh excellent |
I think this can be closed now (given the merged PRs and the ExtensionArray interface functionality). Any remaining problems with concatting would be bugs in the ExtensionArray interface. |
xref #17144
I am trying to get
concat
(and affiliated functionality) working with the external GeometryBlock (which we are developing in geopandas). This is currently failing, and in such a manner (I think) that it will not be fixable in geopandas.Currenlty the
concat
(and theconcatenate_join_units
) functionality has a lot of hardcoded logic about blocks. Two problems that I encountered (so far):it does not respect the 'dimensionality' of the block.
_concat_compat
(pandas/pandas/core/dtypes/concat.py
Line 100 in 34c4ffd
concatenate_join_units
), eg for tz datetimes it defers to_concat_datetimetz
which knows it gets 1D instead of 2D data. The general case however is passed tonp.concatenate(to_concat, axis=axis)
where theaxis
does not take the dimensionality of the Block into account (which leads to an error if your block is non-consolidatable with 1D underlying data)np.concatenate
does not fully the right thing. So a further possible solution would be that there is eg a class method on the block to concatenate the blocks.In general, Block types are not preserved
BlockManager.insert/set
are not able to add a Block while preserving the block class (they always infer the block type based on the data). Other example isconcatenate_block_managers
where the blocks are again reconstructed without taking into account the original block class.@jreback (cc @mrocklin)
The text was updated successfully, but these errors were encountered: