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

BUG: keys argument in pandas.concat does not preserve Index name #14252

Closed
wesm opened this Issue Sep 19, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@wesm
Member

wesm commented Sep 19, 2016

Code Sample, a copy-pastable example if possible

df = pd.DataFrame({'foo': [1, 2, 3, 4],
                   'bar': [0.1, 0.2, 0.3, 0.4]})
index = pd.Index(['a', 'b'], name='baz')

concatted = pd.concat([df, df], keys=index)
concatted.index.names

## -- End pasted text --
Out[3]: FrozenList([None, None])

Expected Output

FrozenList(['baz', None])

output of pd.show_versions()

A few days older than master:

commit: 5e2f9da6e8e713bd89cfe8760e63583ea7d29879

@jreback jreback added this to the Next Major Release milestone Sep 19, 2016

@jreback jreback added the Reshaping label Sep 19, 2016

@rsmith54 rsmith54 referenced this issue Sep 20, 2016

Closed

BUG: fix for GH14252 #14261

4 of 4 tasks complete

@bkandel bkandel referenced this issue Sep 23, 2016

Closed

BUG: Fix concat key name #14292

4 of 4 tasks complete

@jreback jreback modified the milestones: 0.19.1, Next Major Release Oct 8, 2016

@jreback jreback closed this in 16b64f1 Oct 9, 2016

tworec pushed a commit to RTBHOUSE/pandas that referenced this issue Oct 21, 2016

Ben Kandel Piotr Chromiec
BUG: Fix concat key name
closes #14252
Fixes a bug where `pd.concat` didn't propagate the names of keys used to
create  a hierarchical index.

Author: Ben Kandel <ben.kandel@gmail.com>

Closes #14292 from bkandel/fix_concat_key_name and squashes the following commits:

cdc76f6 [Ben Kandel] take out _ensure_index
4a301f8 [Ben Kandel] put back in Index coercion
d8e2c17 [Ben Kandel] remove coercion to Index before _ensure_index
44932cc [Ben Kandel] changed whatsnew entry to 0.19.1
c51df19 [Ben Kandel] _ensure_index
b54b081 [Ben Kandel] simplified logic
3256119 [Ben Kandel] typo
789ecd4 [Ben Kandel] use _ensure_index
350e724 [Ben Kandel] simplified logic
9615a69 [Ben Kandel] extra tests
5c0108b [Ben Kandel] comments
dd3c4cc [Ben Kandel] comments
5cd8392 [Ben Kandel] added test for names
bc5f1fb [Ben Kandel] cleanup
ef6db68 [Ben Kandel] BUG: Propagate key names in concat.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment