Skip to content

Separate out internals.concat, internals.managers #22028

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 1 commit into from
Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions pandas/_libs/internals.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ cdef extern from "compat_helper.h":
Py_ssize_t *slicelength) except -1


from algos import ensure_int64


cdef class BlockPlacement:
# __slots__ = '_as_slice', '_as_array', '_len'
cdef slice _as_slice
Expand Down Expand Up @@ -436,3 +439,26 @@ def get_blkno_indexers(int64_t[:] blknos, bint group=True):
i += 1

yield blkno, result


def get_blkno_placements(blknos, blk_count, group=True):
"""

Parameters
----------
blknos : array of int64
blk_count : int
group : bool

Returns
-------
iterator
yield (BlockPlacement, blkno)

"""

blknos = ensure_int64(blknos)

# FIXME: blk_count is unused, but it may avoid the use of dicts in cython
for blkno, indexer in get_blkno_indexers(blknos, group):
yield blkno, BlockPlacement(indexer)
Loading