-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Timezones are lost in pivot_table #14948
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
Comments
hmm, yes that looks like some older code paths. Need to use want to do a PR? |
Sure; but it might be a few weeks. If anyone else wants to tackle sooner, go for it. |
@gte620v no problem. |
pivot_table
this looks fixed in master if someone wants to add a validation test. |
This still looks like an outstanding issue:
|
Once #19420 is solved, this should be fixed as well. The main cause of the conversion to UTC is an |
Code Sample, a copy-pastable example if possible
Problem description
pivot_table
strips timezone information from the aggregated values.I traced back in the code and it seems that the culprit is
unstack
(pandas/pandas/tools/pivot.py
Line 138 in 4814823
Specifically, either of these numpy operations will strip the tz:
pandas/pandas/core/reshape.py
Lines 75 to 76 in 86233e1
Expected Output
Would expect aggregated values to maintain timezone like they do with groupby.
Output of
pd.show_versions()
pandas: 0.19.1
nose: 1.3.7
pip: 9.0.1
setuptools: 32.1.0.post20161217
Cython: 0.23.4
numpy: 1.10.1
scipy: 0.16.0
statsmodels: 0.6.1
xarray: None
IPython: 5.1.0
sphinx: 1.3.1
patsy: 0.4.0
dateutil: 2.4.2
pytz: 2015.7
blosc: None
bottleneck: 1.0.0
tables: 3.2.2
numexpr: 2.4.4
matplotlib: 1.5.0
openpyxl: 2.2.6
xlrd: 0.9.4
xlwt: 1.0.0
xlsxwriter: 0.7.7
lxml: 3.4.4
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.9
pymysql: None
psycopg2: 2.6.2 (dt dec pq3 ext)
jinja2: 2.8
boto: 2.38.0
pandas_datareader: None
The text was updated successfully, but these errors were encountered: