Skip to content

ValueError Exception during reset_index of timezone-aware data #7875

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
vac opened this issue Jul 30, 2014 · 1 comment
Closed

ValueError Exception during reset_index of timezone-aware data #7875

vac opened this issue Jul 30, 2014 · 1 comment

Comments

@vac
Copy link

vac commented Jul 30, 2014

import pandas as pd
import numpy as np
from datetime import datetime
import pytz

print "This is working:"
data = {23:np.nan, 24:-1949, 25:-1848, 26: np.nan}
date_without_timezone = datetime.now()
df = pd.DataFrame(data, index=[date_without_timezone,])
print df
print
print df.index
print
print df.stack()
print
print df.stack().reset_index() #Good (expected) result

print
print "--------------------"
print

print "This is NOT working:"
date_with_timezone = datetime.now(pytz.utc)
df_with_timezone = pd.DataFrame(data, index=[date_with_timezone,])
print df_with_timezone
print
print df_with_timezone.index
print
print df_with_timezone.stack()
print
print df_with_timezone.stack().reset_index() # EXCEPTION: ValueError: Length of values does not match length of index

INSTALLED VERSIONS

commit: None
python: 2.7.5.final.0
python-bits: 32
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
byteorder: little
LC_ALL: None
LANG: PL

pandas: 0.14.1
nose: None
Cython: None
numpy: 1.8.1
scipy: None
statsmodels: None
IPython: 2.1.0
sphinx: None
patsy: None
scikits.timeseries: None
dateutil: 2.1
pytz: 2014.2
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.3.1
openpyxl: 2.0.3
xlrd: 0.9.3
xlwt: 0.7.5
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
rpy2: None
sqlalchemy: 0.9.4
pymysql: None
psycopg2: 2.5.3 (dt dec pq3 ext)

@sinhrks
Copy link
Member

sinhrks commented Jul 30, 2014

Thanks to the report. It works on the latest master (fixed by #7802).

@jreback jreback closed this as completed Jul 30, 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

3 participants