Skip to content

BUG: Rewrite _make_concat_multiindex #25117

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 1 commit into from

Conversation

toobaz
Copy link
Member

@toobaz toobaz commented Feb 3, 2019

@pep8speaks
Copy link

pep8speaks commented Feb 3, 2019

Hello @toobaz! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on February 03, 2019 at 15:53 Hours UTC

@toobaz toobaz force-pushed the concat_mi_append_20565 branch from 7d6d8f9 to c9898c1 Compare February 3, 2019 15:53
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. otherwise nice cleaning.

@@ -183,6 +183,7 @@ Reshaping

- Bug in :func:`merge` when merging by index name would sometimes result in an incorrectly numbered index (:issue:`24212`)
- :func:`to_records` now accepts dtypes to its `column_dtypes` parameter (:issue:`24895`)
- Bug in :func:`concat` creating a malformed :class:`MultiIndex` when passed multiple frames indexed by identical :class:`MultiIndex`es (:issue:`20565`)
Copy link
Contributor

Choose a reason for hiding this comment

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

you need a space before the es I think

tupleize_cols=True)
tot_df = concat([keys_levs.to_frame().reset_index(drop=True),
orig.to_frame().reset_index(drop=True)], axis=1)
temp_names = [None] * keys_levs.nlevels + list(orig.names)
Copy link
Contributor

Choose a reason for hiding this comment

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

name this empty_ames

# Received names for all levels
result.names = names

if levels is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add some commentary what you are doing here

@jreback jreback added Reshaping Concat, Merge/Join, Stack/Unstack, Explode MultiIndex labels Feb 3, 2019
orig = _concat_indexes(indexes)

# Simplest way to create and prepend the keys level(s):
keys_chunks = [([key] * len(idx)) for (key, idx) in zip(keys, indexes)]
Copy link
Member

Choose a reason for hiding this comment

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

Maybe make this a generator comprehension instead

@jreback
Copy link
Contributor

jreback commented Mar 20, 2019

closing as stale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MultiIndex Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

concat handles MultiIndex differently when index is the same
4 participants