-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
pd.concat reset the tz-aware index to UTC #18523
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
How odd indeed! This example is indeed reproducible on my end this time around. Have a look and see why we're getting this discrepancy in timezone representation. PR is most welcome! |
The issue is from DatetimeIndex : when creating a localized DatetimeIndex, the DatetimeIndex and Timestamps in the DatetimeIndex have different tzinfo ...
|
@antvig this is a bug, probably a duplicate of something in : https://github.com/pandas-dev/pandas/issues?q=is%3Aopen+is%3Aissue+label%3AReshaping+label%3ATimezones but not because of what you show: #18523 (comment) rather the combined index is reset to UTC rather than preserve the incoming tz. i'll mark this. |
The combined index preserve the incoming tz if the two dataframe indexes have exactly the same timezone
Output
|
Seem related to #17572 |
@jorisvandenbossche see my comment above, #17572 is irrelevant |
And how do you explain #18523 (comment)? |
This is due to pandas/pandas/core/indexes/datetimes.py Lines 1141 to 1144 in d3c3c2b
As explained in #17572, such equality check does not always give True, depending on how the |
here is a patch to fix:
thanks to @pganssle for the advice! |
Hi,
I reopen #18422 with copy-pastable example
Code Sample, a copy-pastable example if possible
Output
Problem description
pd.concat reset the tz-aware index to UTC
This seems to come from the two different representation of time zone 'Europe/Paris' as this ipython output shows :
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.2.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.21.0
pytest: None
pip: 9.0.1
setuptools: 28.8.0
Cython: None
numpy: 1.13.1
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.0.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.6.0
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: