Skip to content

BUG: tzinfo lost when concatenating multiindex arrays #7112

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
Jun 4, 2014

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented May 13, 2014

Closes #6606.

The problem is caused by MultiIndex.append. Based on current master, MultiIndex.append works as below. The fix covers case1 and case2 which the result will be MultiIndex.

The fix is applied to concat, and also pivot_table work as expected.

import pandas as pd

idx1 = pd.Index([1.1, 1.2, 1.3])
idx2 = pd.date_range('2011-01-01', freq='D', periods=3, tz='Asia/Tokyo')
idx3 = pd.Index(['A', 'B', 'C'])

midx_lv2 = pd.MultiIndex.from_arrays([idx1, idx2])
midx_lv3 = pd.MultiIndex.from_arrays([idx1, idx2, idx3])

#1 results in MultiIndex, which nlevels is 2
midx_lv2.append(midx_lv2)

#2 results in MultiIndex, which nlevels is 2, not 3. 3rd line will be disappeared.
midx_lv2.append(midx_lv3)

#3 results in tupled Index.
midx_lv2.append(idx1)

#4 results in tupled Index.
result = midx_lv3.append(midx_lv2)

@jreback jreback modified the milestones: 0.15.0, 0.14.1 May 13, 2014
@jreback
Copy link
Contributor

jreback commented Jun 3, 2014

looks fine...pls rebase one more time

@jreback jreback merged commit 88cffbe into pandas-dev:master Jun 4, 2014
@jreback
Copy link
Contributor

jreback commented Jun 4, 2014

thanks!

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

Successfully merging this pull request may close these issues.

tzinfo lost when concatenating multiindex arrays
2 participants