Skip to content

df.reset_index fails with tz-aware column (similar to #7533) #7819

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
rockg opened this issue Jul 22, 2014 · 4 comments
Closed

df.reset_index fails with tz-aware column (similar to #7533) #7819

rockg opened this issue Jul 22, 2014 · 4 comments

Comments

@rockg
Copy link
Contributor

rockg commented Jul 22, 2014

The below fails with "ValueError: Length of values does not match length of index". However, without the timezone it works fine. It's because of pandas/core/frame.py _maybe_casted_values index.tz is not None clause. Something similar was done in #7533 but the added examples don't test this case. cc @sinhrks

import pandas as pd
import numpy as np

dts     =   pd.date_range('1/1/2012', '1/31/2012', freq='D', tz='US/Eastern')
columns =   [1, 2, 3]
data    =   np.random.randn(31, 3)

frame   =   pd.DataFrame(data, columns=columns, index=dts)
frame   =   frame.stack()
frame.reset_index()
@jreback
Copy link
Contributor

jreback commented Jul 22, 2014

in master?

@rockg
Copy link
Contributor Author

rockg commented Jul 22, 2014

At least in .14 Can't check master until later, but the suspect code is the same between .14 and master.

@jreback
Copy link
Contributor

jreback commented Jul 22, 2014

#7802 was just merged in to fix something similar

cc @sinhrks

@jreback
Copy link
Contributor

jreback commented Jul 22, 2014

works in master (might be broken in 0.14.1 as well).

cc @sinhrks

if these tests are different, pls add them

closing as already fixed

@jreback jreback closed this as completed Jul 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants